Kin discrimination is a key process structuring social relationships in animals. We show how it may be generalized to entail discrimination towards non-kin, and provide a first example of this process in a primate. In mandrills, we recently demonstrated increased facial resemblance among paternally-related females indicating adaptive opportunities for paternal kin recognition. Here, we argue that mothers use offspring’s facial resemblance with other infants to guide offspring’s social opportunities. Using deep learning for face recognition combined with long-term field observations, we demonstrate that mothers are spatially closer to infants that resemble their own offspring more, facilitating associations among similar-looking infants. Using theoretical modeling, we describe a plausible evolutionary process whereby mothers gain fitness benefits by promoting nepotism among paternally related infants. This novel mechanism, that we call “second-order kin selection”, may extend beyond mother-infant interactions and has the potential to explain cooperative behaviors among non-kin in social species, including humans.