Objective :China has the largest population living with dementia, causing a tremendous burden on the aging society. Cardiovascular disease (CVD) may trigger a cascade of pathologies associated with cognitive aging. We aim to investigate the association between cardiovascular risk (CVR) factors and cognitive function in the nationally representative cohort in China. Methods: Participants were recruited from 150 counties in 28 provinces via a four-stage sampling method. The outcomes included several cognitive tasks. The independent variable was a composite score of cardiovascular risk calculated from sex-specific equations. We fitted the time-lagged regression to model the association between CVR and cognition. Besides, we performed cross-group analyses to test for model invariance across sex and age. We thus constrained path coefficients to be equal across each grouping variable (e.g., sex) and compared the fit of this constrained model with an unconstrained model in which the path coefficients were allowed to vary by group. Results: A total of 3,799 participants were included in the final analyses. We found that the CVR had a negative linear association with global cognition (β = −0.1, p < 0.01). Additionally, CVR had inverse linear associations with domain-specific measurements of memory and learning, calculation, orientation, and visual-spatial ability (all values of p < 0.01). Regarding sex and age moderation, males had a more pronounced association between higher CVR and worse general cognition, immediate recall, orientation, calculation, and visual-spatial ability (all values of p < 0.0001).