Oceanic crust is formed at mid-ocean spreading centres by a combination of magmatic, tectonic and hydrothermal processes. The crust formed by magmatic process consists of an upper crust generally composed of basaltic dikes and lava flows and a lower crust presumed to mainly contain homogeneous gabbro whereas that by tectonic process can be very heterogeneous and may even contain mantle rocks. Although the formation and evolution of the upper crust are well known from geophysical and drilling results, those for the lower crust remain a matter of debate. Using a full waveform inversion method applied to wide-angle seismic data, here we report the presence of layering in the lower oceanic crust formed at the slow spreading Mid-Atlantic Ridge, ~7-12 Ma in age, revealing that the lower crust is formed mainly by in situ cooling and crystallisation of melt sills at different depths by the injection of magma from the mantle. These layers are 400-600 m thick with alternate high and low velocities, with ± 100-200 m/s velocity variation, and cover over a million-year old crust, suggesting that the crustal accretion by melt sill intrusions beneath the ridge axis is a stable process. We also find that the upper crust is ~400 m thinner than that from conventional travel-time analysis. Taken together, these discoveries suggest that the magmatism plays more important roles in the crustal accretion process at slow spreading ridges than previously realised, and that in-situ lower crustal accretion is the main process for the formation of lower oceanic crust.