IntroductionWith the continuous development of the global aging trend, the mental health of older adults has been a concern by the world. The living space of older adults is limited due to the decline of their activity function. Neighborhood environment, especially the neighborhood social environment, has become an important factor affecting the mental health of older adults. Therefore, this study explores the mechanism that influences the social environment of the neighborhood and the mental health of older adults, the mediating effect of subjective well-being (SWB), and the moderating effect of green space.MethodsBased on the 2018 China Labor Dynamics Survey, this study used the structural equation model to explore the mediating effect of neighborhood social environment (neighborhood ties, social trust, community security) on the mental health of older adults through SWB and the moderating effect of green space.ResultsSocial trust and community security are both directly and positively associated with older adults’ mental health. At the same time, neighborhood ties, social trust, and community security can promote the mental health of older adults by positively affecting SWB, while green space has an enhanced moderating effect between neighborhood ties and mental health.DiscussionThis study enriches the empirical research on neighborhood social environment and mental health. First of all, older adults living in communities with good safety conditions and high social trust are less affected by negative emotions and tend to have good mental health. Second, deeper neighborhood ties, higher social trust, and safer community environments help older adults to be less disturbed by negative situations, have a positive effect on their SWB, and indirectly promote mental health. At the same time, green space can provide a place for older adults to socialize, enhance the positive impact of neighborhood ties on SWB, and further promote the mental health of older adults. Finally, this study suggests that the government and community managers pay attention to the construction of neighborhood social environment and green space, and provide support for “healthy community” and “healthy aging” planning.