The latitudinal gradient of increasing biodiversity from poles to equator is one of the most prominent but least understood features of life on Earth. Here we show that species diversity can be predicted from the biochemical kinetics of metabolism. We first demonstrate that the average energy flux of populations is temperature invariant. We then derive a model that quantitatively predicts how species diversity increases with environmental temperature. Predictions are supported by data for terrestrial, freshwater, and marine taxa along latitudinal and elevational gradients. These results establish a thermodynamic basis for the regulation of species diversity and the organization of ecological communities.