The tendency of organisms to reproduce by cross-fertilization despite numerous disadvantages relative to self-fertilization is one of the oldest puzzles in evolutionary biology. For many species, the primary obstacle to the evolution of outcrossing is the cost of production of males, individuals that do not directly contribute offspring and thus diminish the long-term reproductive output of a lineage. Self-fertilizing ('selfing') organisms do not incur the cost of males and therefore should possess at least a twofold numerical advantage over most outcrossing organisms. Two competing explanations for the widespread prevalence of outcrossing in nature despite this inherent disadvantage are the avoidance of inbreeding depression generated by selfing and the ability of outcrossing populations to adapt more rapidly to environmental change. Here we show that outcrossing is favoured in populations of Caenorhabditis elegans subject to experimental evolution both under conditions of increased mutation rate and during adaptation to a novel environment. In general, fitness increased with increasing rates of outcrossing. Thus, each of the standard explanations for the maintenance of outcrossing are correct, and it is likely that outcrossing is the predominant mode of reproduction in most species because it is favoured under ecological conditions that are ubiquitous in natural environments.