OBJECTIVE: To determine whether hypothalamus-pituitary-adrenal axis (HPAA) dysfunction is prospectively associated with global cognitive impairment in later life. METHODS: This cross-cohort study integrates 2 large longitudinal datasets, Whitehall II and the National Survey for Health and Development (NSHD), on data collected in the Whitehall II study between 2002-2004, 2007-2009, and 2012-2013; and for NSHD between 2006-2010 and in 2015. Serial salivary cortisol samples were collected multiple times within a 24-hour period at mean ages 61.2 and 65.9 years in Whitehall II and at age 60-64 years from NSHD participants. Cortisol profile is defined using cortisol awakening response and am:pm ratio. Cognitive function was measured using the Mini-Mental State Examination in Whitehall II and Addenbrooke's Cognitive Examination, third version, in NSHD, harmonized into a 30-point score. Models were adjusted for age, sex, diagnoses of hypertension and diabetes, body mass index (BMI), educational attainment, and interval between HPAA and cognitive assessments. RESULTS: In fully adjusted models, increased am:pm cortisol ratio was prospectively associated with better later-life cognitive function years later (0.02 fewer errors per SD increase in am:pm cortisol ratio, p < 0.01) and verbal fluency (0.03 SD increase in verbal fluency per SD increase in am:pm ratio, p < 0.01). Increasing age, lower educational attainment, diagnosis of hypertension, diagnosis of diabetes, and increased BMI were associated with worse cognitive function and poorer verbal fluency. There were no associations between depression and later-life cognition or reverse associations between cognition and later-life cortisol profiles. CONCLUSIONS: Loss of diurnal HPAA variation is evident in individuals subsequently experiencing more cognitive impairment. It may serve as an early preclinical marker of cognitive decline.