||We develop a spatially explicit model of diversification based on palaeohabitat to explore the predictions of four major hypotheses potentially explaining the latitudinal diversity gradient (LDG), namely, the 'time-area', 'tropical niche conservatism', 'ecological limits' and 'evolutionary speed' livpotheses. We compare simulation outputs to observed diversity gradients in the global reef fish fauna. Our simulations show that these hypotheses are nonmutually exclusive and that their relative influence depends on the time scale considered. Simulations suggest that reef habitat dynamics produced the LDG during deep geological time, while ecological constraints shaped the modern LDG, with a strong influence of the reduction in the latitudinal extent of tropical reefs during the Neogene. Overall, this study illustrates how mechanistic models in ecology and evolution can provide a temporal and spatial understanding of the role of speciation, extinction and dispersal in generating biodiversity patterns.