Abstract Local density can affect individual performance by altering the strength of species interactions. Within many populations, local densities vary spatially (individuals are patchily distributed) or change across life stages, which should influence the selection and eco‐evolutionary feedback because local density variance affects mean fitness and is affected by traits of individuals. However, most studies on the evolutionary consequences of density‐dependent interactions focus on populations where local densities are relatively constant through time and space. We investigated the influence of spatial and ontogenetic variance in local densities within an insect population by comparing a model integrating both types of local density variance with models including only spatial variance, only ontogenetic variance, or no variance. We parameterized the models with experimental data, then used elasticity and invasion analyses to characterize selection on traits that affect either the local density an individual experiences (mean clutch size) or individuals' sensitivity to density (effect of larval crowding on pupal mass). Spatial and ontogenetic variance reduced population elasticity to effects of local density by 76% and 34% on average, respectively. Spatial variance modified selection and adaptive dynamics by altering the tradeoff between density‐dependent and density‐independent vital rates. In models including spatial variance, strategies that maximized density‐dependent survival were favoured over fecundity‐maximizing strategies even at low population density, counter to predictions of density‐dependent selection theory. Furthermore, only models that included spatial variance, thus linking the scales of oviposition and density‐dependent larval survival, had an evolutionarily stable clutch size. Ontogenetic variance weakened selection on mean clutch size and sensitivity to larval crowding by disrupting the relationship between trait values and performance during critical life stages. We demonstrate that local density variance can strongly modify selection at empirically observed interaction strengths and identify mechanisms for the effects of spatial and ontogenetic variance. Our findings reveal the potential for local density variance to mediate eco‐evolutionary feedback by shaping selection on demographically important traits. Read the free Plain Language Summary for this article on the Journal blog.