The onset of partial melting beneath mid-ocean ridges governs the cycling of highly incompatible elements from the mantle to the crust1, the flux of key volatiles (such as CO2, He and Ar)1,2 and the rheological properties of the upper mantle3. Geophysical observations4-6 indicate that melting beneath ridges begins at depths approaching 300 km, but the cause of this melting has remained unclear. Here we determine the solidus of carbonated peridotite from 3 to 10 GPa and demonstrate that melting beneath ridges may occur at depths up to 330 km, producing 0.03-0.3% carbonatite liquid. We argue that these melts promote recrystallization and realignment of the mineral matrix, which may explain the geophysical observations. Extraction of incipient carbonatite melts from deep within the oceanic mantle produces an abundant source of metasomatic fluids and a vast mantle residue depleted in highly incompatible elements and fractionated in key parent-daughter elements. We infer that carbon, helium, argon and highly incompatible heat-producing elements (such as uranium, thorium and potassium) are efficiently scavenged from depths of ∼200-330 km in the upper mantle.