Social health markers, including marital status, contact frequency, network size, and social support, have been shown to be associated with cognition. However, the mechanisms underlying these associations remain poorly understood. We investigated whether depressive symptoms and inflammation mediated associations between social health and subsequent cognition. In the English Longitudinal Study of Ageing (ELSA), a nationally representative longitudinal study in England, UK, we sampled 7136 individuals aged 50 years or older living in private households without dementia at baseline or at the intermediate mediator assessment timepoint, who had recorded information on at least one social health marker and potential mediator. We used four-way decomposition to examine to what extent depressive symptoms, C-reactive protein, and fibrinogen mediated associations between social health and subsequent standardised cognition (verbal fluency and delayed and immediate recall), including cognitive change, with slopes derived from multilevel models (12-year slope). We examined whether findings were replicated in the Swedish National Study on Aging and Care in Kungsholmen (SNAC-K), a population-based longitudinal study in Sweden, in a sample of 2604 individuals aged 60 years or older living at home or in institutions in Kungsholmen (central Stockholm) without dementia at baseline or at the intermediate mediator assessment timepoint (6-year slope). Social health exposures were assessed at baseline, potential mediators were assessed at an intermediate timepoint (wave 2 in ELSA and 6-year follow-up in SNAC-K); cognitive outcomes were assessed at a single timepoint (wave 3 in ELSA and 12-year follow-up in SNAC-K), and cognitive change (between waves 3 and 9 in ELSA and between 6-year and 12-year follow-ups in SNAC-K). The study sample included 7136 participants from ELSA, of whom 3962 (55·5%) were women and 6934 (97·2%) were White; the mean baseline age was 63·8 years (SD 9·4). Replication analyses included 2604 participants from SNAC-K, of whom 1604 (61·6%) were women (SNAC-K did not collect ethnicity data); the mean baseline age was 72·3 years (SD 10·1). In ELSA, we found indirect effects via depressive symptoms of network size, positive support, and less negative support on subsequent verbal fluency, and of positive support on subsequent immediate recall (pure indirect effect [PIE] 0·002 [95% CI 0·001-0·003]). Depressive symptoms also partially mediated associations between less negative support and slower decline in immediate recall (PIE 0·001 [0·000-0·002]) and in delayed recall (PIE 0·001 [0·000-0·002]), and between positive support and slower decline in immediate recall (PIE 0·001 [0·000-0·001]). We did not observe mediation by inflammatory biomarkers. Findings of mediation by depressive symptoms in the association between positive support and verbal fluency and between positive support and change in immediate recall were replicated in SNAC-K. The findings of this study provide new insights into mechanisms linking social health with cognition, suggesting that associations between interactional aspects of social health, especially social support, and cognition are partly underpinned by depressive symptoms. EU Joint Programme-Neurodegenerative Disease Research (JPND) and Alzheimer's Society. For the Swedish translation of the abstract see Supplementary Materials section.