Spatial environmental heterogeneity is widely accepted and cited as a mechanism underlying the structure of ecological communities. Most empirical evidence related to the effects of environmental heterogeneity comes from assessing how local environments vary in relation to one another and how this variation affects community (and metacommunity) structure. However, similar levels of environmental variation are often structured differently in space, likely affecting species distributions and the ways in which they coexist. Yet, the spatial structure of environmental variation received very little attention. In this study, we set out for the first time a model to understand the effects of the spatial structure of the environment on metacommunity dynamics and its effects on species co-existence at local and regional levels. We built a metacommunity model in a spatially explicit landscape with spatially structured environmental conditions and a continuum of specialist to generalist species that competed for space. Dispersal mortality was set as a function of species’ environmental tolerances and the environmental variation experienced during dispersal. The spatial structure of the environment was found to increase local and regional coexistence, while also selecting for more specialist species. In landscapes with strong spatial structure, patches with similar environmental values were clustered together, thus facilitating the successful colonization of suitable patches by specialist species. Conversely, weakly structured landscapes selected for generalist species. As such, increased environmental spatialization fostered niche partitioning, facilitating coexistence and, as a result, increasing local and regional diversity.