One of the ecological tenets justifying conservation of biodiversity is that diversity begets stability. Impacts of biodiversity on population dynamics and ecosystem functioning have long been debated1–7, however, with many theoretical explorations2–6,8–11 but few field studies12–15. Here we describe a long-term study of grasslands16,17 which shows that primary productivity in more diverse plant communities is more resistant to, and recovers more fully from, a major drought. The curvilinear relationship we observe suggests that each additional species lost from our grasslands had a progressively greater impact on drought resistance. Our results support the diversity—stability hypothesis5,6,18,19, but not the alternative hypothesis that most species are functionally redundant19–21. This study implies that the preservation of biodiversity is essential for the maintenance of stable productivity in ecosystems.