SummaryBackgroundMillions of children globally are at risk of not reaching their developmental potential because of early adversities. We hypothesised that responsive caregiving and learning opportunities, components of nurturing care, at pre-school ages might mitigate the effects of adversities.MethodsWe analysed longitudinal birth cohort data from Brazil (1993 Pelotas Birth Cohort, n=632) and South Africa (Birth to Twenty Plus [Bt20+] Birth Cohort, n=1130) to assess whether responsive caregiving and learning opportunities at pre-school ages (2–4 years) modified associations between cumulative early adversities and adolescent human capital. The cumulative adversities score (range 0–9) included household wealth and crowding; mothers' schooling, height, age, and mental health; and children's birthweight, gestational age, and length at age 12 months. We extracted data on responsive caregiving and learning opportunities from the Early Childhood Home Observation for Measurement of the Environment inventory, assessed at age 4 years (1993 Pelotas cohort) and 2 years (Bt20+ cohort). We examined three human capital indicators: intelligence quotient (IQ) assessed at age 18 years (1993 Pelotas cohort) and 16 years (Bt20+ cohort); psychosocial adjustment assessed at age 15 years and 14 years, respectively; and height assessed at age 18 years and 16 years, respectively. We used linear models with interaction terms between cumulative adversities, and responsive caregiving and learning opportunities, to predict adolescent human capital.FindingsFor each additional Z score of total cumulative adversity, adolescent IQ decreased by 5·89 (95% CI −7·29 to −4·50) points in the 1993 Pelotas cohort (p<0·0001) and 2·69 (–4·52 to −0·86) points in the Bt20+ cohort (p=0·0039). After adjusting for total cumulative adversities, adolescent IQ points increased by 5·47 (95% CI 4·20 to 6·74) with each additional Z score of learning opportunities and by 2·26 (0·93 to 3·59) with each additional Z score of responsive caregiving in the 1993 Pelotas cohort, but not in the Bt20+ cohort (0·86 [–0·12 to 1·83] and 0·65 [–0·32 to 1·61], respectively). Associations between early adversities and IQ were modified by learning opportunities in the 1993 Pelotas cohort (beta coefficient for interaction 1·74, 95% CI 0·43 to 3·04; p=0·0092) and by responsive caregiving in the Bt20+ cohort (2·24, 0·94 to 3·54; p=0·0075). High nurturing environment attenuated the negative effects of early cumulative adversities on IQ.InterpretationEarly nurturing home environments protect young children against effects of early adversities on adolescent IQ, with long-term positive associations on adolescent cognition in two middle-income countries.FundingBill & Melinda Gates Foundation.