Spatial self-structuring has been a focus of recent interest among evolutionary ecologists. We review recent developments in the study of the interplay between spatial self-structuring and evolution. We first discuss the relative merits of the various theoretical approaches to spatial modelling in ecology. Second, we synthesize the main theoretical studies of the evolution of cooperation in spatially structured populations. We show that population viscosity is generally beneficial to cooperation, because cooperators can reap additional benefits from being clustered. A similar mechanism can explain the evolution of honest communication and of reduced virulence in host–parasite interactions. We also discuss some recent innovative empirical results that test these theories. Third, we show the relevance of these results to the general field of evolutionary ecology. An important conclusion is that kin selection is the main process that drives evolution of cooperation in viscous populations. Many results of kin selection theory can be recovered as emergent properties of spatial ecological dynamics. We discuss the implications of these results for the study of multilevel selection and evolutionary transitions. We conclude by sketching some perspectives for future research, with a particular emphasis on the topics of evolutionary branching, criticality, spatial fluctuations and experimental tests of theoretical predictions.