Mid-ocean-ridge basalts (MORBs) are the most abundant terrestrial magmas and are believed to form by partial melting of a globally extensive reservoir of ultramafic rocks in the upper mantle. MORBs vary in their abundances of incompatible elements (that is, those that partition into silicate liquids during partial melting) and in the isotopic ratios of several radiogenic isotope systems. These variations define a spectrum between 'depleted' and 'enriched' compositions, characterized by respectively low and high abundances of incompatible elements. Compositional variations in the sources of MORBs could reflect recycling of subducted crustal materials into the source reservoir, or any of a number of processes of intramantle differentiations. Variations in (18)O/(16)O (principally sensitive to the interaction of rocks with the Earth's hydrosphere) offer a test of these alternatives. Here we show that (18)O/(16)O ratios of MORBs are correlated with aspects of their incompatible-element chemistry. These correlations are consistent with control of the oxygen-isotope and incompatible-element geochemistry of MORBs by a component of recycled crust that is variably distributed throughout their upper mantle sources.