In contrast with the many studies of stress effects on the brain, relatively little is known about the molecular mechanisms of resilience, the ability of some individuals to escape the deleterious effects of stress. We found that the transcription factor DeltaFosB mediates an essential mechanism of resilience in mice. Induction of DeltaFosB in the nucleus accumbens, an important brain reward-associated region, in response to chronic social defeat stress was both necessary and sufficient for resilience. DeltaFosB induction was also required for the standard antidepressant fluoxetine to reverse behavioral pathology induced by social defeat. DeltaFosB produced these effects through induction of the GluR2 AMPA glutamate receptor subunit, which decreased the responsiveness of nucleus accumbens neurons to glutamate, and through other synaptic proteins. Together, these findings establish a previously unknown molecular pathway underlying both resilience and antidepressant action.