Urban residents typically live longer, if they live in leafy neighborhoods, and link green areas with lower premature mortality rates, according to a study.

Urban trees are already credited with cooling, purifying and absorbing greenhouse gases, and researchers at the Barcelona Institute of Global Health have found that trees also eliminate the risk of death.

"More green spaces are better for health," said Mark Niwanewisen, director of the Urban Planning, Environment and Health Initiative at the institute. "People actually live longer if there is more green space around them."

The study, published on Wednesday, was based on data from nine other studies involving more than 8 million people in seven countries from China to Canada, the researchers said, confirming it was the largest of its kind ever.

The researchers used satellite imagery to estimate the amount of vegetation, including trees, grass and shrubs within 500 meters of the study's homes.

Levels of vegetation were arranged on a scale subject to a system known as the "Natural Vegetation Difference Index".

The researchers followed the study for several years, taking into account any premature deaths from health conditions such as heart disease or respiratory disease.

The study, published in The Lancet Planetary Health, found that in many cities, from Barcelona in Spain to Perth in Australia, a 10 percent increase in greenery led to a 4 percent drop in median premature mortality.

While the researchers did not consider specific reasons, Newwann said that vegetation is known to benefit mental health, reduce stress and pollution and encourage physical activity.