Sticking to health goals is more successful with affirmation.

Looking for a little help achieving your health goals? The key to success may be all in your mind.

A new study published in the Proceedings of the National Academy of Sciences indicates that self-affirmation can help reinforce healthy practices.

Emily Falk, lead author of the study and director of the Communication Neuroscience Lab at the University of Pennsylvania’s Annenberg School for Communication, said when people reflect on their values, it can help them view otherwise threatening messages as valuable and self-relevant.

“Our work shows that when people are affirmed, their brains process subsequent messages differently,” said Falk in a statement.

Falk said many people are told to adopt healthy practices, but they sometimes perceive those messages as threatening.

For example, when a doctor tells a patient to lose weight to improve their health, the patient may be offended. When the patient reflects on their core values first, and are therefore “affirmed,” it can help them embrace the health message and create positive change.

If that patient considers losing weight can extend their life so they have more time with loved ones, that affirmation may be just the thing that helps them stick to a weight loss program.

In the study, researchers from multiple universities divided 67 sedentary adults into two groups.

They guided the first group (the affirmation group) to affirmations that reflected their core values. Next, researchers exposed the group to health messages that might otherwise seem threatening.

Read More: Weight Loss Surgery Lengthens Life »

A second group (the non-affirmation group) was asked to think about values that were not important to them. They then were subjected to the same health messages.

An example of a health message used was, “People who sit less are at lower risk for certain diseases.”

Falk used functional magnetic resonance imaging (fMRI) to examine the ventromedial prefrontal cortex (VMPFC) area of the brain. The VMPFC is the part of the brain that is used to process self-relevance.

All of the participants wore devices on their wrists that measured their activity levels before, during, and a month after the intervention. After the session, researchers texted participants with health messages and monitored their wrist devices.

The affirmation group showed higher levels of activity in the VMPFC and moved around more than the non-affirmation group.

Falk said understanding how the brain processes affirmations opens the door to new health treatments.

“This technique could help make health advice more powerful and accessible to people,” she said.

Falk said affirmations work best when they are not related to the goal. In this case, the researchers wanted to see if affirmations would get less-active people moving. They used affirmations related to the individuals’ core values, such as family or religion — not weight or body image.

‘Healthy Obesity’ Debunked, Find Out Why »

“Whatever brings that person to most meaning would be better,” she said.

“Taking five minutes to write about something that brings you meaning and why can do the trick as well,” she added.

Dr. Charlie Seltzer, a weight loss specialist based in Philadelphia, said trying this technique is a “no brainer” for people who are struggling to attain goals.

He said people can better stick to health plans with a variety of mental tricks — he uses one himself.

“Before I eat something I know does not fit with my long-term goals, I take five minutes to imagine how I will feel afterward,” he explained. “Imagining the mental anguish it will cause along with the physical symptoms of overeating is a powerful deterrent.

Read More: Why Employers Want You to Be Healthy »