Background: Influences of prenatal and early-life exposures to air pollution on cognition are not well understood. Objectives: We examined associations of gestational and childhood exposure to traffic-related pollution with childhood cognition. Methods: We studied 1,109 mother–child pairs in Project Viva, a prospective birth cohort study in eastern Massachusetts (USA). In mid-childhood (mean age, 8.0 years), we measured verbal and nonverbal intelligence, visual motor abilities, and visual memory. For periods in late pregnancy and childhood, we estimated spatially and temporally resolved black carbon (BC) and fine particulate matter (PM2.5) exposures, residential proximity to major roadways, and near-residence traffic density. We used linear regression models to examine associations of exposures with cognitive assessment scores, adjusted for potential confounders. Results: Compared with children living ≥ 200 m from a major roadway at birth, those living < 50 m away had lower nonverbal IQ [–7.5 points; 95% confidence interval (CI): –13.1, –1.9], and somewhat lower verbal IQ (–3.8 points; 95% CI: –8.2, 0.6) and visual motor abilities (–5.3 points; 95% CI: –11.0, 0.4). Cross-sectional associations of major roadway proximity and cognition at mid-childhood were weaker. Prenatal and childhood exposure to traffic density and PM2.5 did not appear to be associated with poorer cognitive performance. Third-trimester and childhood BC exposures were associated with lower verbal IQ in minimally adjusted models; but after adjustment for socioeconomic covariates, associations were attenuated or reversed. Conclusions: Residential proximity to major roadways during gestation and early life may affect cognitive development. Influences of pollutants and socioeconomic conditions on cognition may be difficult to disentangle. Citation: Harris MH, Gold DR, Rifas-Shiman SL, Melly SJ, Zanobetti A, Coull BA, Schwartz JD, Gryparis A, Kloog I, Koutrakis P, Bellinger DC, White RF, Sagiv SK, Oken E. 2015. Prenatal and childhood traffic-related pollution exposure and childhood cognition in the Project Viva cohort (Massachusetts, USA).