Retiring securely often boils down to having confidence in one's level of savings. And while there's no magic number that guarantees you won't spend down your nest egg too quickly, it stands to reason that the more you have saved, the greater your odds of maintaining an income stream for life.

But there's another factor that can influence seniors' attitude about retirement: their health. In fact, new data from the Employee Benefit Research Institute shows a solid connection between good health and retirement confidence. As per a recently released study, 60% of near-retirees who are confident going into their golden years consider themselves to be in excellent or good health. The same holds true for 46% of current retirees whose health is strong. Seniors who aren't in good health, by contrast, are more likely to have trouble managing their money in retirement.

Senior couple running outdoors

IMAGE SOURCE: GETTY IMAGES.

Of course, you can't snap your fingers and magically arrange for years of good health going forward. But you can do two very important things if you want retire with more confidence: take care of yourself, and prepare for the medical costs that will likely lie ahead, whether your health is solid, abysmal, or somewhere in between.

Stay on top of your health

One reason so many seniors end up spending a fortune on healthcare is that they let medical issues escalate rather than nip them in the bud. Once you turn 65 and go on Medicare, you'll be entitled to a host of free preventive services each year, so plan to use them.

Until then, have a yearly physical to get ahead of health problems that may be lurking. Exercising and taking care of your health in general will also help you keep your medical costs to a minimum, so make an effort to eat well, maintain a healthy weight, and engage in some sort of physical activity on a regular basis, provided a medical professional hasn't advised otherwise. Going into retirement in optimal health won't guarantee you won't face issues down the line, but it'll certainly lower your odds.

Plan for healthcare spending in retirement

Medical care is an expense seniors are bound to encounter regardless of how healthy or unhealthy they are. If you're still working, one good way to alleviate some of the stress associated with it is to learn what costs may be coming your way, and save for them.

It's estimated that the average 65-year-old man today will spend $189,687 on medical care in retirement. For the average 65-year-old woman, this number jumps to $214,565 to account for females' longer life expectancies.

If these figures seem surprising, it's partly because seniors are living longer these days, but also because there are a host of services Medicare won't cover, from dental to vision to hearing. Plus, don't forget that Medicare itself isn't free. While most people don't pay a premium for Part A, which covers hospitals, they do pay premiums for Part B, which covers diagnostics and preventive care, and Part D, which deals with prescription drugs. On top of those premiums, there are also copays and deductibles to content with, which means even if your health is stellar, you still might spend roughly $200,000 on medical care throughout retirement.

Here's a little more bad news: The above figures don't account for long-term care -- an expense that 70% of seniors 65 and over are likely to need. And unfortunately, the numbers on long-term care are even more daunting. The average assisted living facility nationwide costs $3,750 per month, or $45,000 per year, according to Genworth Financial's 2017 Cost of Care Survey. The average nursing home, meanwhile, costs $235 per day, or $85,775 per year, and that's for a semi-private room. Private quarters will set you back $267 per day, or $97,455 per year.

Knowing about these costs in advance, though, will help you enter retirement with more confidence, especially if you save for them accordingly. Furthermore, purchasing long-term care insurance when you're younger could help offset some of the expenses you might face later on, and the younger you are when you apply, the more likely you are to snag a health-based discount on your premiums for life.

Along these lines, a Medicare Advantage plan might give you the coverage you need to better manage your health-related bills once you turn 65. Medicare Advantage is an alternative to traditional Medicare that's often more cost-effective, so as retirement nears, it pays to look into that option.

Either way, don't let health-related issues prevent you from approaching retirement with confidence. Roughly 25% of current seniors say that medical costs are keeping them from living their dream retirements, so don't become part of that statistic. Save for the expenses that lie ahead, get the right coverage and insurance, and be extra-vigilant about minding your health so issues don't escalate. With any luck, that'll help you enjoy your golden years to the fullest, even with that ever-present expense tugging away at your nest egg.

The Motley Fool has a disclosure policy.