The role of selection in speciation is a central yet poorly understood problem in evolutionary biology. The rapid radiations of extremely colorful cichlid fish in African lakes have fueled the hypothesis that sexual selection can drive species divergence without geographical isolation. Here we present experimental evidence for a mechanism by which sexual selection becomes divergent: in two sibling species from Lake Victoria, female mating preferences for red and blue male nuptial coloration coincide with their context-independent sensitivities to red and blue light, which in turn correspond to a difference in ambient light in the natural habitat of the species. These results suggest that natural selection on visual performance, favoring different visual properties in different spectral environments, may lead to divergent sexual selection on male nuptial coloration. This interplay of ecological and sexual selection along a light gradient may provide a mechanism of rapid speciation through divergent sensory drive.