Sexual selection drives rapid phenotypic diversification of mating traits. However, we know little about the causative genes underlying divergence in sexually selected traits. Here, we investigate the genetic basis of male mating trait diversification in the medaka fishes (genus Oryzias) from Sulawesi, Indonesia. Using linkage mapping, transcriptome analysis, and genome editing, we identify csf1 as a causative gene for red pectoral fins that are unique to male Oryzias woworae. A cis-regulatory mutation enables androgen-induced expression of csf1 in male fins. csf1-knockout males have reduced red coloration and require longer for mating, suggesting that coloration can contribute to male reproductive success. Contrary to expectations, non-red males are more attractive to a predatory fish than are red males. Our results demonstrate that integrating genomics with genome editing enables us to identify causative genes underlying sexually selected traits and provides a new avenue for testing theories of sexual selection.