Female Drosophila melanogaster frequently mate with multiple males, and the success of a given male depends not only on his genotype but also on the genotype of his competitor. Here, we assess how natural genetic variation affects male–male interactions for traits influencing pre- and postcopulatory sexual selection. Males from a set of 66 chromosome substitution lines were competed against each other in a ‘round-robin’ design, and paternity was scored using bulk genotyping. We observed significant effects of the genotype of the first male to mate, the second male to mate and an interaction between the males for measures of male mating rate and sperm utilization. We also identified specific combinations of males who show nontransitive patterns of reproductive success and engage in ‘rock-paper-scissors’ games. We then tested for associations between 245 polymorphisms in 32 candidate male reproductive genes and male reproductive success. We identified eight polymorphisms in six reproductive genes that associate with male reproductive success independent of the competitor (experimentwise P < 0.05). We also identified four SNPs in four different genes where the relative reproductive success of the alternative alleles changes depending on the competing males' genetic background (experimentwise P < 0.05); two of these associations include premature stop codons. This may be the first study that identifies the genes contributing to nontransitivity among males and further highlights that ‘rock-paper-scissors’ games could be an important evolutionary force maintaining genetic variation in natural populations.