Background: Physical activity is increasingly recognized as an important modifiable factor for depression. However, the extent to which individuals with stable risk factors for depression, such as high genetic vulnerability, can benefit from the protective effects of physical activity, remains unknown. Using a longitudinal biobank cohort integrating genomic data from 7,968 individuals of European ancestry with high-dimensional electronic health records and lifestyle survey responses, we examined whether physical activity was prospectively associated with reduced risk for incident depression in the context of genetic vulnerability.Methods: We identified individuals with incident episodes of depression, based on two or more diagnostic billing codes for a depressive disorder within 2 years following their lifestyle survey, and no such codes in the year prior. Polygenic risk scores were derived based on large-scale genome-wide association results for major depression. We tested main effects of physical activity and polygenic risk scores on incident depression, and effects of physical activity within stratified groups of polygenic risk.Results: Polygenic risk was associated with increased odds of incident depression, and physical activity showed a protective effect of similar but opposite magnitude, even after adjusting for BMI, employment status, educational attainment, and prior depression. Higher levels of physical activity were associated with reduced odds of incident depression across all levels of genetic vulnerability, even among individuals at highest polygenic risk.Conclusions: Real-world data from a large healthcare system suggest that individuals with high genetic vulnerability are more likely to avoid incident episodes of depression if they are physically active.