We examined associations between cognition and mortality and how these relationships vary by race and Apolipoprotein E (APOE) genotype, in a longitudinal study of 2346 middle-aged White and African American adults (30–64 years at baseline) from the Healthy Aging in Neighborhoods of Diversity across the Life Span cohort study. Baseline cognition spanned global mental status, and several domains obtained using principal components analysis (PCA; PCA1: verbal memory/fluency; PCA2: attention/working memory; PCA3: executive function/visuo-spatial abilities). Cox regression models evaluated associations between cognition and all-cause and cardiovascular disease (CVD)-mortality. Interactions between cognition and APOE2 as well as APOE4 allelic dose were tested, and race was a key effect modifier. Higher APOE4 dose was associated with increased CVD-mortality (hazard ratio [HR] per allele = 1.37; 95% CI 1.01–1.86, p = 0.041); APOE2 dosage’s association with CVD-mortality was non-significant (HR = 0.60; 95% CI 0.35–1.03, p = 0.065). Higher PCA3 was associated with lower all-cause (HR = 0.93; 95% CI 0.87–0.99, p = 0.030) and CVD (HR = 0.85; 95% CI 0.77–0.95, p = 0.001) mortality risks, the latter association being more pronounced among Whites. PCA2 interacted synergistically with APOE2 dosage, reducing risks for all-cause mortality (PCA2 × APOE2: − 0.33 ± 0.13, p = 0.010) and CVD mortality (PCA2 × APOE2: − 0.73 ± 0.31, p = 0.019). In conclusion, greater executive function/visuo-spatial abilities were associated with reduced CVD-specific mortality, particularly among Whites. Greater “attention/working memory” coupled with higher APOE2 dosage was linked with reduced all-cause and CVD mortality risks.