Exercising in your young-adult years may bring better thinking skills in middle age, according to new research.

In the study, 2,747 healthy people ages 18 to 30 ran on a treadmill for as long as they could, and then did the same 20 years later. They also took cognitive tests 25 years after the start of the study to measure their verbal memory, psychomotor speed (the relationship between thinking skills and physical movement) and higher thinking skills.

The results showed that for every additional minute people ran on the treadmill at the study's start, they recalled more words correctly on the memory test, and did better on the psychomotor speed test 20 years later. The link held even after the researchers adjusted for other factors, such as smoking, diabetes and high cholesterol.

Many studies show the association between good cardiovascular health and healthy brain function, said study author David R. Jacobs Jr., a professor of public health at the University of Minnesota in Minneapolis. "This study is significant in that it shows an association between cardiovascular fitness in one's youth and having better thinking skills at a later age," he said.

For the treadmill test, which was similar to a cardiovascular stress test, participants walked or ran as the speed and incline were increased, until they could not continue or experienced shortness of breath. Cardiorespiratory fitness is an indicator of how well the body transports oxygen to the muscles, and how well the muscles are able to use oxygen during exercise. [How to Stick to an Exercise Routine]

Participants lasted an average of 10 minutes on the treadmill for the first test, and about 3 minutes less 20 years later.

Those who had smaller decreases in their time spent on the treadmill test were more likely to perform better on the thinking-skills test than those who had bigger decreases in their time spent on the treadmill.

"These findings are likely to help us identify dementia at an earlier age and, consequently, prevent or treat those at high risk of developing it," Jacobs told Live Science.

Dr. Stuart C. Sealfon, chairman of the department of neurology at The Mount Sinai Hospital in New York City, said the results of the study are interesting, and that exercise should be encouraged for overall good health.

However, the findings show "an association between cardio fitness in one's youth and better brain function later in life, not a cause-and-effect relationship," Sealfon said. Additional studies are needed, he said, to show a causal relationship.

The study is published online April 2 in the journal Neurology.

More on LiveScience and MNN:

This story was originally written for LiveScience and has been republished with permission here. Copyright 2014 LiveScience, a TechMediaNetwork company.