Cooperation via production of common goods is found in diverse life forms ranging from viruses to social animals. However, natural selection predicts a “tragedy of the commons”: Cheaters, benefiting from without producing costly common goods, are more fit than cooperators and should destroy cooperation. In an attempt to discover novel mechanisms of cheater control, we eliminated known ones using a yeast cooperator–cheater system engineered to supply or exploit essential nutrients. Surprisingly, although less fit than cheaters, cooperators quickly dominated a fraction of cocultures. Cooperators isolated from these cocultures were superior to the cheater isolates they had been cocultured with, even though these cheaters were superior to ancestral cooperators. Resequencing and phenotypic analyses revealed that evolved cooperators and cheaters all harbored mutations adaptive to the nutrient-limited cooperative environment, allowing growth at a much lower concentration of nutrient than their ancestors. Even after the initial round of adaptation, evolved cooperators still stochastically dominated cheaters derived from them. We propose the “adaptive race” model: If during adaptation to an environment, the fitness gain of cooperators exceeds that of cheaters by at least the fitness cost of cooperation, the tragedy of the commons can be averted. Although cooperators and cheaters sample from the same pool of adaptive mutations, this symmetry is soon broken: The best cooperators purge cheaters and continue to grow, whereas the best cheaters cause rapid self-extinction. We speculate that adaptation to changing environments may contribute to the persistence of cooperative systems before the appearance of more sophisticated mechanisms of cheater control.