Overflow metabolism refers to the seemingly wasteful strategy in which cells use fermentation instead of the more efficient respiration to generate energy, despite the availability of oxygen. Known as the Warburg effect in the context of cancer growth, this phenomenon occurs ubiquitously for fast-growing cells, including bacteria, fungi and mammalian cells, but its origin has remained unclear despite decades of research. Here we study metabolic overflow in Escherichia coli, and show that it is a global physiological response used to cope with changing proteomic demands of energy biogenesis and biomass synthesis under different growth conditions. A simple model of proteomic resource allocation can quantitatively account for all of the observed behaviours, and accurately predict responses to new perturbations. The key hypothesis of the model, that the proteome cost of energy biogenesis by respiration exceeds that by fermentation, is quantitatively confirmed by direct measurement of protein abundances via quantitative mass spectrometry.