Reproductive isolation and speciation can result from the establishment of either premating or postmating barriers that restrict gene flow between populations. Recent studies of speciation have been dominated by a molecular approach to dissect the genetic basis of hybrid male sterility, a specific form of postmating reproductive isolation. However, relatively little attention has been paid to the evolution of genes involved in premating isolation and genes generally involved in other sex-related functions (e.g., mating behavior, fertilization, spermatogenesis, sex determination). We have assembled DNA sequences from 51 nuclear genes and classified them based on their functional characteristics. The proportion of nonsynonymous to synonymous nucleotide substitutions were compared between Drosophila melanogaster, Drosophila simulans, and Drosophila pseudoobscura, as well as between Caenorhabditis elegans and Caenorhabditis briggsae. We found a high ratio of nonsynonymous to synonymous substitutions for sex-related genes (i.e., genes involved in mating behavior, fertilization, spermatogenesis, or sex determination). The results suggest that directional sexual selection has shaped the evolution of sex-related genes and that these changes have more likely occurred during the early stages of speciation. It is possible that directional selection becomes relaxed after reproductive isolation has been completed between more distantly related species (e.g., D. melanogaster and D. pseudoobscura). However, a saturation in the number of nucleotide substitutions since the time of species separation may mask any sign of directional selection between more distantly related species.