Remarkable palaeoclimatic global changes have been recorded worldwide during the middle Miocene. The Miocene Climatic Optimum (~ 16.3 to ~ 15 Ma), one of the warmest phases since the Eocene, was followed by the stepwise cooling trend of the Middle Miocene Climate Transition (~ 15 to ~ 13.7 Ma). The entry into an Earth “Ice-house” climate state took place at the end of the latter (~ 13.76 Ma) marked by one of the major cooling steps in middle Miocene climate recorded at a global scale (Mi3b event). The Madrid Basin, which is part of one of the main Cenozoic basins of the Iberian Peninsula, contains a well-represented small-mammal record from the lower middle Miocene to the upper middle Miocene (middle and upper Aragonian, ~ 15.9 to 12.8 Ma), being an appropriate region to check how these climatic phases influenced the distribution of the mammalian faunas on the center of the Iberian Peninsula. Values of species richness, equitability and heterogeneity of rodents have been calculated for 25 localities of the Madrid Basin and compared to detailed climate isotope records from the marine realm (ODP Site 1146 from the South China Sea and the Mediterranean record of the Ras Il Pellegrin section on the Maltese Islands) and with palaeoprecipitation curves for southwest Europe (Calatayud-Montalbán Basin). The results show that the rodent community during the middle and upper Aragonian in the Madrid Basin was subject to the changing climate conditions imposed in the course of the middle Miocene. The palaeoecological curves witness periods of disturbance of the community during changing climate conditions (marked by important drops in equitability and, in some cases, gradual decreases in heterogeneity and species richness), followed by periods showing a recovery of the community and adaptation to the new climate circumstances (represented by more evenly distributed and diverse assemblages). The effects of the Miocene Climate Optimum and of three Mi-events (Mi2b, Mi3a and Mi3b) have been related to changes in the small-mammal community. Between ~ 15.8 and 15.3 Ma, the likely extreme environment (high temperature and low precipitation) of part of the Miocene Climate Optimum may have imposed severe constraints on the fauna, resulting in a community with low values of equitability, heterogeneity and a decreasing number of species. The transition of the Miocene Climate Optimum to the Middle Miocene Climate Transition, reflected by the Mi2b event, has also procured a destabilization of the rodent assemblages, as an important drop in equitability is recorded between ~ 15 and 14.6 Ma. In this interval, the drop in temperature and increase in rainfall derived from the Middle Miocene Climate Transition promote the southwards migration of northern invaders, leading to an increase in species richness in the Madrid Basin. Starting around 14.4 Ma, the onset of a progressive drop in the rodent equitability and heterogeneity, which also coincides with a major stratigraphic discordance in the basin, is related to the first cooling step of the Middle Miocene Climate Transition (Mi3a event). Finally, the major cooling step in middle Miocene climate recorded at a global scale (Mi3b event) is poorly reflected in the palaeoecological curves. However, the taxonomical study of the rodent faunas of that interval (biozone E) has shown turnover rates and morphometric changes that indicate that this period represents one of the most variable in assemblage composition within the Aragonian. Although the Mi3b event has been correlated for a long time to the substitution of the early-middle Aragonian fauna by a late Aragonian community (E–F boundary), the study of the rodent assemblages of the Madrid Basin may point out that small changes in the small-mammal community started before (within biozone E).