Understanding factors that increase ecosystem stability is critical in the face of environmental change. Biodiversity plays a key role in buffering ecosystems against disturbances such as extreme climatic events. The evolution of biological communities within their local environment may also increase ecosystem stability and resilience, but this has yet to be tested. Here, we provide evidence for such evolutionary effects using a long-term grassland biodiversity experiment. Communities of plants with a history of co-occurrence (co-selected communities) were temporally more stable at low diversity than the same communities of plants with no such history (naïve communities). Furthermore, co-selected communities exhibited greater recovery following a major flood, resulting in more stable post-flood productivity. These results demonstrate that community evolution can increase ecosystem stability under normal circumstances and in response to extreme disturbance, but also suggest that high diversity can in part compensate for evolutionary naïvety.