The magmatic layers of the oceanic crust are created at constructive plate margins by partial melting of the mantle as it wells up. The chemistry of ocean floor basalts, the most accessible product of this magmatism, is studied for the insights it yields into the compositional heterogeneity of the mantle and its thermal structure. However, before eruption, parental magma compositions are modified at crustal pressures by a process that has usually been assumed to be fractional crystallization. Here we show that the global distributions of trace elements in ocean floor basalts describe a systematic pattern that cannot be explained by simple fractional crystallization alone, but is due to cycling of magma through the global ensemble of magma chambers. Variability in both major and incompatible trace-element contents about the average global pattern is due to fluctuations in the magma fluxes into and out of the chambers, and their depth, as well as to differences in the composition of the parental magmas.