Background: Alzheimer's disease is one of the most heritable diseases in elderly people and the most common type of dementia. In addition to the major genetic determinant of Alzheimer's disease, the APOE gene, 23 genetic variants have been associated with the disease. We assessed the effects of these variants and APOE on cumulative risk and age at onset of Alzheimer's disease and all-cause dementia. Methods: We studied incident dementia in cognitively healthy participants (aged >45 years) from the community-based Rotterdam Study, an ongoing prospective cohort study based in Rotterdam, the Netherlands, focusing on neurological, cardiovascular, endocrine, and ophthalmological disorders, and other diseases in elderly people. The Rotterdam Study comprises participants in three baseline cohorts (initiated in 1990, 2000, and 2006), who are re-invited to the research centre every 3–4 years, and continuously monitored by records from general practitioners and medical specialists. Cumulative incidence curves up to age 100 years were calculated for Alzheimer's disease and dementia, taking into account mortality as a competing event. These risk curves were stratified by APOE genotypes, tertiles of a weighted genetic risk score (GRS) of 23 Alzheimer's disease-associated genetic variants, and parental history of dementia. Findings: 12 255 of 14 926 participants (58·5% women) from the Rotterdam Study were included in this study. During a median follow-up of 11·0 years (IQR 4·9–15·9; 133 123 person years), 1609 participants developed dementia, of whom 1262 (78%) were classified as having Alzheimer's disease; 3310 people died of causes other than dementia. Both APOE and the GRS significantly modified the risks of Alzheimer's disease and dementia. There was evidence for a significant interaction between APOE genotypes and the GRS for the association with Alzheimer's disease (p=0·03) and dementia (p=0·04); the risk for carriers homozygous for APOE ε4 was modified most by the GRS. In carriers homozygous for APOE ε4, the difference between the high-risk tertile and the low-risk tertile by age 85 years was 27·0% for Alzheimer's disease (p=8·5 × 10−3) and 37·2% for dementia (p=2·2 × 10−4), which translates to a 7–10 year difference in age at onset. Comparing the risk extremes, which were carriers homozygous for APOE ε2 or heterozygous with one copy each of the ε2 and ε3 alleles in the low-risk tertile of the GRS versus carriers homozygous for APOE ε4 in the high-risk tertile of the GRS, the difference in risk by age 85 years was 58·6% (4·1% vs 62·7%; p=6·2 × 10−13) for Alzheimer's disease, and 70·3% (7·2% vs 77·5%; p=3·0 × 10−23) for dementia. These risk differences translate into an 18–29 years difference in age at onset for Alzheimer's disease and an 18–23 year difference in age at onset dementia. This difference becomes more pronounced when parental history of dementia is considered (difference in risk 83·8%; p=1·1 × 10−20). Interpretation: Common variants with small individual effects jointly modify the risk and age at onset of Alzheimer's disease and dementia, particularly in APOE ε4 carriers. These findings highlight the potential of common variants in determining Alzheimer's disease risk. Funding: None.