Fishes are the most diverse group of vertebrates, play key functional roles in aquatic ecosystems, and provide protein for a billion people, especially in the developing world. Those functions are compromised by mounting pressures on marine biodiversity and ecosystems. Because of its economic and food value, fish biomass production provides an unusually direct link from biodiversity to critical ecosystem services. We used the Reef Life Survey’s global database of 4,556 standardized fish surveys to test the importance of biodiversity to fish production relative to 25 environmental drivers. Temperature, biodiversity, and human influence together explained 47% of the global variation in reef fish biomass among sites. Fish species richness and functional diversity were among the strongest predictors of fish biomass, particularly for the large-bodied species and carnivores preferred by fishers, and these biodiversity effects were robust to potentially confounding influences of sample abundance, scale, and environmental correlations. Warmer temperatures increased biomass directly, presumably by raising metabolism, and indirectly by increasing diversity, whereas temperature variability reduced biomass. Importantly, diversity and climate interact, with biomass of diverse communities less affected by rising and variable temperatures than species-poor communities. Biodiversity thus buffers global fish biomass from climate change, and conservation of marine biodiversity can stabilize fish production in a changing ocean.