An association of gestational weight gain (GWG) with offspring cognition has been postulated. We used data from the Avon Longitudinal Study of Parents and Children, a United Kingdom prospective cohort (1990 through the present) with a median of 10 maternal weight measurements in pregnancy. These were used to allocate participants to 2009 Institute of Medicine weight-gain categories and in random effect linear spline models. Outcomes were School Entry Assessment score (age, 4 years; n = 5,832), standardized intelligence quotient assessed by Wechsler Intelligence Scale for Children (age, 8 years; n = 5,191), and school final-examination results (age, 16 years; n = 7,339). Offspring of women who gained less weight than recommended had a 0.075 standard deviation lower mean School Entry Assessment score (95% confidence interval: -0.127, -0.023) and were less likely to achieve adequate final-examination results (odds ratio = 0.88, 95% confidence interval: 0.78, 0.99) compared with offspring of women who gained as recommended. GWG in early pregnancy (defined as 0-18 weeks on the basis of a knot point at 18 weeks) and midpregnancy (defined as 18-28 weeks on the basis of knot points at 18 and 28 weeks) was positively associated with School Entry Assessment score and intelligence quotient. GWG in late pregnancy (defined as 28 weeks onward on the basis of a knot point at 28 weeks) was positively associated with offspring intelligence quotient and with increased odds of offspring achieving adequate final-examination results in mothers who were overweight prepregnancy. Findings support small positive associations between GWG and offspring cognitive development, which may have lasting effects on educational attainment up to age 16 years.