Several studies have shown cardiovascular disease (CVD) to be associated with dementia, but it is not clear whether CVD per se increases the risk of dementia or whether the association is due to shared risk factors. We tested how a genetic risk score (GRS) for coronary artery disease (CAD) affects dementia risk after CVD in 13 231 Swedish twins. We also utilized summarized genome-wide association data to study genetic overlap between CAD and Alzheimer´s disease (AD), and additionally between shared risk factors and each disease. There was no direct effect of a CAD GRS on dementia (hazard ratio 0.99, 95% confidence interval (CI): 0.98-1.01). However, the GRS for CAD modified the association between CVD and dementia within 3 years of CVD diagnosis, ranging from a hazard ratio of 1.59 (95% CI: 1.05-2.41) in the first GRS quartile to 1.91 (95% CI: 1.28-2.86) in the fourth GRS quartile. Using summary statistics, we found no genetic overlap between CAD and AD. We did, however, find that both AD and CAD share a significant genetic overlap with lipids, but that the overlap arose from clearly distinct gene clusters. In conclusion, genetic susceptibility to CAD was found to modify the association between CVD and dementia, most likely through associations with shared risk factors.