Males of many species harm females as a byproduct of intrasexual competition, but this harm can be reduced if males are less competitive in the presence of familiar relatives. We determined the cue males use to identify competitors in this context. We assessed genetic variance in a putative kin recognition trait (cuticular hydrocarbons) in male seed beetles Callosobruchus maculatus and found that five hydrocarbons had significant components of additive genetic variance and could serve as relatedness cues. Next, we tested whether hydrocarbons were the mechanism males use to distinguish the social identities of competitors when strategically adjusting their competitiveness/harmfulness. Pairs of female and male C. maculatus were mated in the presence of hydrocarbons extracted from males that differed in their relatedness and familiarity to the focal male. Females were more productive after mating in the presence of extracts from the focal male's nonrelatives, if those extracts were also unfamiliar to the focal male. Relatedness had no effect on productivity when extracts were familiar to the focal male. These results may be reconciled with those of previous studies that manipulated the relatedness and familiarity of competing males if the difference between the effect of harmfulness on productivity following a single mating and the effect on lifetime reproductive fitness after multiple matings is accounted for. This study provides a novel demonstration of the mechanism of social recognition in the moderation of sexual conflict.