Researchers claim being surrounded by green space leads to people having fewer negative feelings and therefore less of a tendency to reach for unhealthy treats.
Exposure to nature even in small amounts has been shown to improve general wellbeing.
And the researchers said this could help understand the causes of cravings and therefore improve insight into diseases caused by excess, such as obesity and diabetes.
The study, led by the University of Plymouth, asked 149 participants to complete an online survey about where they lived and their guilty pleasures.
Participants selected items for which they regularly experienced cravings – most people said food (38 per cent) or chocolate (32 per cent).
Addictive items were also an often-reported choice, with caffeine topping 16 per cent of people's lists, nicotine five per cent and alcohol nine per cent.
Among other things, the study measured the proportion of green space in each participant's neighbourhood, the amount of greenery they could see from their home, their access to a garden or allotment and how often they went to a public green space like a park.
The results showed that those who had access to a garden or allotment, or had a view from their house at least a quarter made up of green space experienced cravings both less frequently and with less intensity.
Leanne Martin, who led the research as part of her master's degree in Plymouth, said: 'It has been known for some time that being outdoors in nature is linked to a person's wellbeing.
'But for there to be a similar association with cravings from simply being able to see green spaces adds a new dimension to previous research.
'This is the first study to explore this idea, and it could have a range of implications for both public health and environmental protection programs in the future.'
The study also measured the amount of exercise people did, but showed the reduced craving still worked regardless of their physical activity level.
Dr Sabine Pahl, Associate Professor in Psychology, said: 'Craving contributes to a variety of health-damaging behaviours such as smoking, excessive drinking and unhealthy eating.
'In turn, these can contribute to some of the greatest global health challenges of our time, including cancer, obesity and diabetes.
'Showing that lower craving is linked to more exposure to green spaces is a promising first step.
'Future research should investigate if and how green spaces can be used to help people withstand problematic cravings, enabling them to better manage cessation attempts in the future.'
The study, published in the journal Health and Place, points to the need to protect and invest in green spaces within towns and cities in order to improve public health, the researchers said.
They also suggested the link be investigated further.
Health Secretary Matt Hancock has said he wants to see 'the balance shifted' from drugs to social activities to improve the country’s health.
He has backed the expansion of 'social prescribing' – which is non-medical treatment such as going for regular walks or working on an allotment –as a way of relieving the pressure on the NHS.