To manoeuvre in complex societies, it is beneficial to acquire knowledge about the social relationships existing among group mates, so as to better predict their behaviour. Although such knowledge has been firmly established in a variety of animal taxa, how animals acquire such knowledge, as well as its functional significance, remains poorly understood. In order to understand how primates acquire and use their social knowledge, we studied kin-biased redirected aggression in Japanese macaques (Macaca fuscata) relying on a large database of over 15 000 aggressive episodes. Confirming previous research, macaques redirected aggression preferentially to the kin of their aggressor. An analysis that controlled for the rate of affiliation between aggressors and targets of redirection showed that macaques identified the relatives of group mates on the basis of the frequency of their ongoing associations. By contrast, having observed group mates interact with their mother as infants did not increase the monkeys' success in correctly identifying kin relationships among third parties. Inter-individual variation in the successful identification of the kin of aggressors and in redirecting aggression accordingly translated into differences in the amount of aggression received, highlighting a selective advantage for those individuals that were better able to acquire and use social knowledge.