Exposure to green space has been associated with better physical and mental health. Although this exposure could also influence cognitive development in children, available epidemiological evidence on such an impact is scarce. This study aimed to assess the association between exposure to green space and measures of cognitive development in primary schoolchildren. This study was based on 2,593 schoolchildren in the second to fourth grades (7–10 y) of 36 primary schools in Barcelona, Spain (2012–2013). Cognitive development was assessed as 12-mo change in developmental trajectory of working memory, superior working memory, and inattentiveness by using four repeated (every 3 mo) computerized cognitive tests for each outcome. We assessed exposure to green space by characterizing outdoor surrounding greenness at home and school and during commuting by using high-resolution (5 m × 5 m) satellite data on greenness (normalized difference vegetation index). Multilevel modeling was used to estimate the associations between green spaces and cognitive development. We observed an enhanced 12-mo progress in working memory and superior working memory and a greater 12-mo reduction in inattentiveness associated with greenness within and surrounding school boundaries and with total surrounding greenness index (including greenness surrounding home, commuting route, and school). Adding a traffic-related air pollutant (elemental carbon) to models explained 20–65% of our estimated associations between school greenness and 12-mo cognitive development. Our study showed a beneficial association between exposure to green space and cognitive development among schoolchildren that was partly mediated by reduction in exposure to air pollution.