Existing evidence on the beneficial effects of nature on mental health comes from studies using cross-sectional designs. We developed a smartphone-based tool (Urban Mind; www.urbanmind.info) to examine how exposure to natural features within the built environment affects mental well-being in real time. The tool was used to monitor 108 individuals who completed 3013 assessments over a 1-week period. Significant immediate and lagged associations with mental well-being were found for several natural features. These associations were stronger in people with higher trait impulsivity, a psychological measure of one's tendency to behave with little forethought or consideration of the consequences, which is indicative of a higher risk of developing mental-health issues. Our investigation suggests that the benefits of nature on mental well-being are time-lasting and interact with an individual's vulnerability to mental illness. These findings have potential implications from the perspectives of global mental health as well as urban planning and design.