||Aim: The importance of quantifying the contribution of historical processes in shaping current biodiversity patterns is now recognized, but quantitative approaches that explicitly link speciation, extinction and dispersal processes to palaeo-environmental changes are currently lacking. Here, we propose a spatial diversification model of lineages through time (SPLIT) based on the reconstruction of palaeo-environments. We illustrate our approach using mangroves as a case study and evaluate whether habitat changes caused by plate tectonics explain the current biodiversity patterns of this group. Innovations: The SPLIT model allows one to simulate the evolutionary dynamics of species ranges by spatially linking speciation, extinction and dispersal processes to habitat changes over geological time periods. The SPLIT model provides a mechanistic expectation of speciation and extinction assuming that species are ecologically identical and not interacting. The likelihood of speciation and extinction is equivalent across species and depends on two dispersal parameters interacting with habitat dynamics (d a maximum dispersal distance and ds a distance threshold beyond which gene flow is absent). Beyond classical correlative approaches, this model tracks biodiversity dynamics under palaeo-environmental changes and provides multiple expectations (i.e., alpha-, beta-diversity, phylogenies) that can be compared to empirical patterns. Main conclusions: The SPLIT model allows a better understanding of the origin of biodiversity by explicitly accounting for habitat changes over geological times. The simulations applied to the mangrove case study reproduced the observed longitudinal gradient in species richness, the empirical pattern of beta-diversity and also provided inference on diversification rates. Future developments may include niche evolution and species interactions to evaluate the importance of non-neutral mechanisms. The method is fully implemented in the InsideDNA platform for bioinformatics analyses, and all modelling results can be accessed via interactive web links.