Urban green space has been regarded as contributing to citizen happiness by promoting physical and mental health. However, how urban green space and happiness are related across many countries of different socioeconomic conditions has not been explained well. By measuring urban green space score (UGS) from high-resolution Sentinel-2 satellite imagery of 90 global cities that in total cover 179,168 km$^2$ and include 230 million people in 60 developed countries, we reveal that the amount of urban green space and the GDP can explain the happiness level of the country. More precisely, urban green space and GDP are each individually associated with happiness; happiness in the 30 wealthiest countries is explained only by urban green space, whereas GDP alone explains happiness in the 30 other countries in this study. Lastly, we further show that the relationship between urban green space and happiness is mediated by social support and that GDP moderates the relationship between social support and happiness, which underlines the importance of maintaining urban green space as a place for social cohesion in promoting peoples happiness.