There is mounting evidence that biodiversity increases the stability of ecosystem processes in changing environments, but the mechanisms that underlie this effect are still controversial and poorly understood. Here, we extend mechanistic theory of ecosystem stability in competitive communities to clarify the mechanisms underlying diversity–stability relationships. We first explain why, contrary to a widely held belief, interspecific competition should generally play a destabilising role. We then explore the stabilising effect of differences in species' intrinsic rates of natural increase and provide a synthesis of various potentially stabilising mechanisms. Three main mechanisms are likely to operate in the stabilising effects of biodiversity on ecosystem properties: (1) asynchrony of species' intrinsic responses to environmental fluctuations, (2) differences in the speed at which species respond to perturbations, (3) reduction in the strength of competition. The first two mechanisms involve temporal complementarity between species, while the third results from functional complementarity. Additional potential mechanisms include selection effects, behavioural changes resulting from species interactions and mechanisms arising from trophic or non-trophic interactions and spatial heterogeneity. We conclude that mechanistic trait-based approaches are key to predicting the effects of diversity on ecosystem stability and to bringing the old diversity–stability debate to a final resolution.