Recent studies have identified a number of genes that regulate life span. When these genes are inactivated, organisms live longer, but suffer no obvious adverse effects. These results have generated considerable debate, largely because current evolutionary theory is unable to explain them. In this article, I report results from an individual-based spatial model in which a programmed age of death is allowed to evolve. In a freely mixing population with global dispersal, evolution selects for individuals with ever-increasing life span. However, in a spatially structured population with localized dispersal, a programmed age of death evolves. The exact age of death that evolves depends critically on the scale of dispersal. Within this model, individuals are genetically programmed to die, even though they are still able to reproduce. These results suggest that death can be adaptive and offer an explanation for the evolution of "death genes."