A recent scientific study reveals that getting fit in middle age not only adds years to your life through a variety of health benefits — it can also reduce your risk for heart failure.

Researchers ranked fitness levels of 9,050 men and women (average age 48) who took two fitness tests — eight years apart — during mid-life. After 18 years of follow-up, they matched the fitness information to Medicare claims for heart failure hospitalizations.

The study revealed that participants who weren’t fit at the beginning of the study were at higher risk for heart failure after age 65. Participants who improved their fitness level during the study, however, reduced their heart failure risk, compared to those who continued to have a low fitness level eight years later.

The researchers used metabolic equivalents (METs), a measure of how people do on a treadmill test. For each MET improvement in fitness, participants’ heart failure risk dropped by 20%. For example, if a 40-year-old went from jogging 12 minutes per mile to running 10 minutes per mile — an increase of two METs — he or she reduced heart failure risk at a later age by 40%.

Currently, more than 5.1 million Americans live with heart failure, according to the American Heart Association. By 2030, the prevalence of heart failure may increase 25%.

It’s never too late to start working out. Improving fitness is a good heart failure prevention strategy that can be employed in mid-life to decrease the risk of heart failure in later years.