How much is that Soul Cycle class, again? It’s an important question to ask given some new research from TD Bank that shows most millennials prioritize healthy eating and staying in shape over saving more and spending less. Of course, a healthy lifestyle is never a bad thing. The trouble arises when you start spending more than your budget allows on things like exclusive classes, nightly smoothies and personal trainers — which is an all-too-easy trap to fall into.

“You could have the fittest body in the world, but if you’re finding yourself strapped by debt or financial insecurity, it doesn’t matter if you can run a marathon or not — your mental state is going to make you unhealthy,” says Kimberlee Davis, managing director and partner at wealth management firm The Bahnsen Group. The good news is that a long run in the park can be just as beneficial as a $40 barre class, and if you have your finances in order, you’re more likely to be healthy in other areas, too. Here’s how to get both your finances and your fitness working in your favor.

Striking the Balance

There’s little debating that being healthy does often require some financial investment in the way of healthy food and exercise. On the flipside, there’s a tremendous economic cost to obesity that can’t be ignored. So how do you strike the balance?

First, recognize that the healthcare costs of being unhealthy can quickly usurp what you’d spend at the gym. In other words, the $40 spin class and vitamin supplements you purchase today will wind up being much cheaper than the doctor’s copays you’ll be saddled with if you develop diabetes, heart disease or any of the other conditions associated with extra weight, says Jillian Cohen, CEO & co-founder of Virtual Health Partners, an online wellness platform that offers nutritionist appointments, live fitness classes, and more. “There’s a cost to you, to society, and to your employer that insures you,” she says. Which is not to say you should be dropping $40 on a regular spin class when you can’t afford it.

While it’s certainly possible to spend thousands of dollars per year on healthy food options, (we’ve all seen the menus with the $20 salad and the $10 burger and fries) you can save money when you cut the bad stuff out of your diet. “Once you’ve made the decision to lead a healthy lifestyle, you’re not going to be eating out every day,” Cohen says. “Making things at home and packing your lunch is going to save you so much money.”

Think Ahead (Or Automate So You Don’t Have To)

It’s difficult for some people to think ahead to their retirement years, which is why many people opt for short-term rewards instead of putting money away for future. That’s a problem. Research from Fidelity Investments projects that a 65-year-old couple will need $280,000 just for non-reimbursed medical expenses in retirement. The easiest way to get yourself to save enough is to automate contributions wherever possible — that includes your 401(k) or other retirement plan, emergency fund and Health Savings Account. “The game is very, very long, but you have to start playing early,” Davis says. “When your money has a 30-year period to mature, it’s going to do a lot more than if it has only a 10-year period.”

Healthy Finances = Confidence

Self esteem and money are inextricably linked — the TD Bank study showed that 41 percent of those satisfied with their financial health are more likely to be satisfied with their physical health, emotional wellness and family well-being. That makes sense, Davis says. Healthy finances give us a greater sense of independence. In addition, the vast majority of people surveyed — 87 percent — said that goals (including fitness, health, career, etc.) became easier to accomplish when their finances were in order. Clearly, it’s a worthwhile pursuit. So how do you boost your confidence?

One word: Education. “We’re terrified of what we don’t know,” Davis says. “That’s why these topics are intimidating to us.” Start by digging into specific financial topics online. If you’re looking for an overhaul of your entire financial life — akin to a financial physical — sitting down for a few hours with a financial planner makes sense. It doesn’t have to cost a bundle. If you have a retirement plan at work, you may be eligible to meet with a planner one-on-one for free. Otherwise, there are fee-only financial advisors through the Garrett Planning Network who are willing to charge by the hour.

When in doubt, budget for your health and fitness goals

Retail therapy makes us feel good — even when we’re buying a pack of sessions with a trainer or new running shoes. Unfortunately, it can be easy to feel that we “deserve” purchases like these, since staying healthy is so important. But we have to create boundaries to prevent overspending on health and wellness just like we would with any other category of our budget.

“There are things like rent and the electric bill, and those are non-disposable every month,” Cohen says. “Then there are other things like a gym membership and classes, and those need to be rated according to how happy they make you, and what you feel you’re getting out of them.” Once you rate them, come up with a short list of what you both enjoy and can afford, she says. From there, you’ll be able to see exactly what you’re spending where, and what you might be able to scrap in favor of something else.

When you’re making health-related purchases, a good rule of thumb is to ask yourself of each item: “Do I really need this to be healthy?” Cohen says. “It may be that you don’t need a gym membership at all — you can reach your goals by doing two classes per week and running outside. The idea that you have to spend a lot of money to be fit is a myth.”

With Kathryn Tuggle

GET MORE SAVING AND SPENDING HACKS

Want more tips like these? NBC News BETTER is obsessed with finding easier, healthier and smarter ways to live. Sign up for our newsletter and follow us on Facebook, Twitter and Instagram.