Fast evolutionary changes are common in natural populations, though episodes of rapid evolution do not generally last for long and are typically associated with changing environments. During such periods, evolutionary dynamics may influence ecological population dynamics and vice versa. This review is concerned with spatial eco-evolutionary dynamics with a focus on the occurrence of species in marginal habitats and on metapopulations inhabiting heterogeneous environments. Dispersal and gene flow are key processes in both cases, linking demographic and evolutionary dynamics to each other, facilitating but also constraining the expansion of the current niche and the geographical range of species and determining the spatial scale and pattern of adaptation in heterogeneous environments. An eco-evolutionary metapopulation model helps explain the contrasting responses of species to habitat loss and fragmentation. Eco-evolutionary dynamics may facilitate the persistence of species in changing environments, but typically the evolutionary response only partially compensates for the negative ecological consequences of adverse environmental changes.