Colonization of new ecological niches has triggered large adaptive radiations. Although some lineages have made use of such opportunities, not all do so. The factors causing this variation among lineages are largely unknown. Here, we show that deficiency in docosahexaenoic acid (DHA), an essential ω-3 fatty acid, can constrain freshwater colonization by marine fishes. Our genomic analyses revealed multiple independent duplications of the fatty acid desaturase gene Fads2 in stickleback lineages that subsequently colonized and radiated in freshwater habitats, but not in close relatives that failed to colonize. Transgenic manipulation of Fads2 in marine stickleback increased their ability to synthesize DHA and survive on DHA-deficient diets. Multiple freshwater ray-finned fishes also show a convergent increase in Fads2 copies, indicating its key role in freshwater colonization.