Divergent natural selection acting on ecological traits, which also affect mate choice, is a key element of ecological speciation theory, but has not previously been demonstrated at the molecular gene level to our knowledge. Here we demonstrate parallel evolution in two cichlid genera under strong divergent selection in a gene that affects both. Strong divergent natural selection fixed opsin proteins with different predicted light absorbance properties at opposite ends of an environmental gradient. By expressing them and measuring absorbance, we show that the reciprocal fixation adapts populations to divergent light environments. The divergent evolution of the visual system coincides with divergence in male breeding coloration, consistent with incipient ecological by-product speciation.