Although some consensus exists regarding the positive synergism between energy and heterogeneity in increasing species diversity, the role of environmental variability remains controversial. We examine how these factors interact to explain spatial variation in mammal species richness in South America. After taking into account the effects of spatial autocorrelation and area, elevation variability and energy mainly drive spatial variation in mammal species richness. The effect of environmental variability is less important. When different taxonomic groups of mammals are analyzed separately, three ways emerge whereby energy and heterogeneity interact to promote species richness. Heterogeneity may have no effect on species richness, habitat heterogeneity and energy availability contribute independently to species richness, or heterogeneity increases in importance with an increase in energy availability. The partition of species into range size quartiles shows that habitat heterogeneity and temporal instability in the resource supply account for the species richness pattern in the narrowest- ranging species. Habitat heterogeneity is significant also for intermediate ranging species but not for the widest-ranging species. Energy alone drives the species richness pattern in the latter species. The interplay between ecology and biogeographic history may ultimately explain these differences given that narrow- and wide-ranging species show distinct biogeographic patterns, and different taxonomic groups also unequally represent them.