Most species are exposed to significant environmental gradients across their ranges, but vital rates (survival, growth, reproduction and recruitment) need not respond in the same direction to those gradients. Opposing vital rate trends across environments, a phenomenon that has been loosely called 'demographic compensation', may allow species to occupy larger geographical ranges and alter their responses to climate change. Yet the term has never been precisely defined, nor has its existence or strength been assessed for multiple species. Here, we provide a rigorous definition, and use it to develop a strong test for demographic compensation. By applying the test to data from 26 published, multi-population demographic studies of plants, we show that demographic compensation commonly occurs. We also investigate the mechanisms by which this phenomenon arises by assessing which demographic processes and life stages are most often involved. In addition, we quantify the effect of demographic compensation on variation in population growth rates across environmental gradients, a potentially important determinant of the size of a species' geographical range. Finally, we discuss the implications of demographic compensation for the responses of single populations and species' ranges to temporal environmental variation and to ongoing environmental trends, e.g. due to climate change.