Understanding the processes that maintain diversity has been the focus of extensive study, yet there is much that has not been integrated into a cohesive framework. First, there is a separation of perspective. Ecological and evolutionary approaches to diversity have progressed in largely parallel directions. Second, there is a separation of emphasis. In both ecology and population genetics, classical theories favour local explanations with emphasis on population dynamics and selection within populations, while contemporary theories favour spatial explanations, with emphasis on population structure and interactions among populations. What is lacking is a comparative approach that evaluates the relative importance of local and spatial processes in maintaining genetic and ecological diversity. I present a framework for diversity maintenance that emphasizes the comparative approach. I use a well-known but little-used mathematical approach, the perturbation theorem for dynamical systems, to identify key points of contact between ecological and population genetic theories of coexistence. These connections provide for a synthesis of several important concepts: population structure (source-sink versus extinction-colonization), spatial heterogeneity (intrinsic versus extrinsic) in fitness and competitive ability, and temporal scales over which local and spatial processes influence diversity. This framework ties together a large and diverse body of theory and data from ecology and population genetics. It yields comparative predictions that can serve as guidelines in biodiversity management.