Social interactions depend on individuals recognizing each other, and in this context many organisms use chemical signals to indicate species and sex. Cuticular hydrocarbon signals are used by insects, including Drosophila melanogaster, to distinguish conspecific individuals from others. These chemicals also contribute to intraspecific courtship and mating interactions. However, the possibility that sex and species identification are linked by common chemical signalling mechanisms has not been formally tested. Here we provide direct evidence that a single compound is used to communicate female identity among D. melanogaster, and to define a reproductive isolation barrier between D. melanogaster and sibling species. A transgenic manipulation eliminated cuticular hydrocarbons by ablating the oenocytes, specialized cells required for the expression of these chemical signals. The resulting oenocyte-less (oe(-)) females elicited the normal repertoire of courtship behaviours from males, but were actually preferred over wild-type females by courting males. In addition, wild-type males attempted to copulate with oe(-) males. Thus, flies lacking hydrocarbons are a sexual hyperstimulus. Treatment of virgin females with the aversive male pheromone cis-vaccenyl acetate (cVA) significantly delayed mating of oe(-) females compared to wild-type females. This difference was eliminated when oe(-) females were treated with a blend of cVA and the female aphrodisiac (7Z,11Z)-heptacosadiene (7,11-HD), showing that female aphrodisiac compounds can attenuate the effects of male aversive pheromones. 7,11-HD also was shown to have a crucial role in heterospecific encounters. Specifically, the species barrier was lost because males of other Drosophila species courted oe(-) D. melanogaster females, and D. simulans males consistently mated with them. Treatment of oe(-) females with 7,11-HD restored the species barrier, showing that a single compound can confer species identity. These results identify a common mechanism for sexual and species recognition regulated by cuticular hydrocarbons.