When I lived in L.A., I reported on a school near Long Beach in which nearly a fifth of the students had asthma. One culprit seemed to be the school’s unfortunate geography: About 500 trucks passed by its grounds every hour, and according to a study released at the time, at least 9 percent of childhood-asthma cases in the area were attributable to road traffic. The air near the school, which sometimes smelled rotten or rubbery, contained nearly twice the normal level of elemental carbon, a marker of diesel particles.

Asthma is just one of the health problems linked to air pollution exposure. Sniffing exhaust all day also contributes to everything from stroke to premature death.

Conversely, spending time in nature is correlated with better mental health, attention, and mood in both children and adults. A new study out Monday in the Proceedings of the National Academy of Sciences suggests that green spaces can actually boost cognitive outcomes in children—in part by protecting their brains from air pollutants.

For the large study involving 2,623 schoolchildren in Barcelona, researchers first assessed the amount of greenery around the children’s homes, along their commutes to school, and surrounding the schools themselves. They then measured the children’s working memories and attention spans using a series of word and number tests.

The children who had more vegetation around their schools showed more progress in working memory and attention over the course of a year, a finding that held true even after the authors controlled for socioeconomic status. (The associations with the commute and home-based greenery were not as strong.)

PNAS

Not only did the plant life soak up much of the elemental carbon around the schools, the authors write, green spaces are also known to reduce city noise and stress while increasing opportunities for exercise.

More than half the world’s population lives in cities, so it’s not exactly practical for every child to attend school in the middle of a forest. Still, the results suggest that green space can be an important factor in designing school environments—and in drafting environmental regulations.