Aim To analyse the diversity dynamics of Miocene mammalian faunas in the Iberian Peninsula in order to determine whether the patterns are related to the dispersal of taxa from other areas into this region.Location Mainly the Iberian Peninsula, but two close geographical areas (Central Europe and the Eastern Mediterranean) are also considered in some of our calculations.Methods Genus-level faunal lists for a total of 299 localities from the Iberian Peninsula, covering 10 successive biochronological units [Mammal Neogene (MN) zones] that span from the latest Early Miocene to the early Pliocene (about 17-4 Ma), were compiled. The dataset was expanded with a further 331 localities in Central Europe and the Eastern Mediterranean for the same time span. Next, a taxonomically standardized database was used to create composite faunal lists of micro-and macromammalian genera present during each MN zone. Separate genera-by-MN-zone matrices for both micro-and macromammals were built for each region. Mean standing diversity as well as origination and extinction rates were calculated for the Iberian Peninsula, and their correlation with preservation rates is discussed. Simpson's coefficient of faunal similarity with Central Europe and the Eastern Mediterranean was calculated in order to evaluate whether diversity patterns were related to changes in the affinity of the Iberian mammalian faunas with those of other regions.Results Diversity changes in the Iberian macromammalian faunas coincide with periods of increased faunal similarity with other regions, suggesting a relationship to the expansions and contractions of the geographical ranges of the constituent taxa. This pattern is not recognized for micromammals; that is, their diversity trends are not related to changes in geographical ranges.Main conclusions Climatic shifts result in expansions or contractions in the geographical ranges of macromammals, owing to changes in the distribution of their preferred habitats. The lower dispersal ability of micromammals results in a higher extinction risk when habitat fragmentation confines their populations to relatively small environmental patches. Hence, they are more severely affected by climatic changes. Our results thus emphasize the role of climatic forcing in mammalian biogeography and diversity.