Silicate liquids play a key part at all stages of deep Earth evolution, ranging from core and crust formation billions of years ago to present-day volcanic activity. Quantitative models of these processes require knowledge of the structural changes and compression mechanisms that take place in liquid silicates at the high pressures and temperatures in the Earth's interior. However, obtaining such knowledge has long been impeded by the challenging nature of the experiments. In recent years, structural and density information for silica glass was obtained at record pressures of up to 100 GPa (ref. 1), a major step towards obtaining data on the molten state. Here we report the structure of molten basalt up to 60 GPa by means of in situ X-ray diffraction. The coordination of silicon increases from four under ambient conditions to six at 35 GPa, similar to what has been reported in silica glass. The compressibility of the melt after the completion of the coordination change is lower than at lower pressure, implying that only a high-order equation of state can accurately describe the density evolution of silicate melts over the pressure range of the whole mantle. The transition pressure coincides with a marked change in the pressure-evolution of nickel partitioning between molten iron and molten silicates, indicating that melt compressibility controls siderophile-element partitioning.