It remains unclear whether biodiversity buffers ecosystems against climate extremes, which are becoming increasingly frequent worldwide1. Early results suggested that the ecosystem productivity of diverse grassland plant communities was more resistant, changing less during drought, and more resilient, recovering more quickly after drought, than that of depauperate communities2. However, subsequent experimental tests produced mixed results3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13. Here we use data from 46 experiments that manipulated grassland plant diversity to test whether biodiversity provides resistance during and resilience after climate events. We show that biodiversity increased ecosystem resistance for a broad range of climate events, including wet or dry, moderate or extreme, and brief or prolonged events. Across all studies and climate events, the productivity of low-diversity communities with one or two species changed by approximately 50% during climate events, whereas that of high-diversity communities with 16–32 species was more resistant, changing by only approximately 25%. By a year after each climate event, ecosystem productivity had often fully recovered, or overshot, normal levels of productivity in both high- and low-diversity communities, leading to no detectable dependence of ecosystem resilience on biodiversity. Our results suggest that biodiversity mainly stabilizes ecosystem productivity, and productivity-dependent ecosystem services, by increasing resistance to climate events. Anthropogenic environmental changes that drive biodiversity loss thus seem likely to decrease ecosystem stability14, and restoration of biodiversity to increase it, mainly by changing the resistance of ecosystem productivity to climate events.