Aim Given their high environmental variation over relatively short distances, mountains represent ideal systems for evaluating potential factors shaping diversity gradients. Despite a long-standing interest in ecological gradients, ant diversity patterns and their related mechanisms occurring on mountains are still not well understood. Here, we (i) describe species diversity patterns (alpha and beta) of leaf-litter ants along the eastern slope of Cofre de Perote in Veracruz, Mexico; and (ii) evaluate climatic and spatial factors in determining these patterns. Location Veracruz, Mexico. Taxon Leaf-litter ants. Methods We sampled 320 m(2) of leaf litter spread across eight equally spaced sites from sea level to 3500 m of elevation. We used regression models to predict alpha-diversity patterns with climatic (temperature and precipitation) and spatial (geometric constraints) variables. We also assessed, through multiple regression based on distance matrices (MRM), the relative importance of habitat filtering and dispersal limitations for shaping total dissimilarity (beta sor), turnover (beta sim) and nestedness (beta nes). Results A hump-shaped pattern was observed in the alpha-diversity. This pattern is best explained by the temperature gradient. beta-diversity showed a nonlinear pattern along the elevational gradient with total dissimilarity and turnover components better explained by habitat filtering (i.e. temperature distances). Turnover had higher contribution to total dissimilarity rather than the nestedness component. Main conclusions The significance effect of temperature on both alpha- and beta-diversity patterns reinforces its widespread importance in shaping litter ant diversity patterns across elevational gradients. The hump-shaped pattern in species richness is probably the result of harsh abiotic conditions at the base and the top of the mountain combined with biotic attrition in lowland sites. The niche specialization of ant species in their optimal thermal zones may explain total dissimilarity and ant species replacement along the studied gradient. Taken all together, these results suggest a high relevance of temperature-driven mechanisms in the origin and maintenance of the biodiversity of such insects and probably another ectothermic taxa.