The findings also raise the prospect that people who do not get enough of the vitamin could use supplements to keep the brain fully functioning as they age, David Lee and colleagues at the University of Manchester reported.
"At the population level, we are talking about large numbers of people. If there is a link it could potentially have a significant effect," Lee, who led the study, said in a telephone interview. "It is so easy to rectify with supplementation."
Recent studies have also indicated vitamin D may protect against cancer, artery disease and tuberculosis.
While others have suggested a link with mental ability, the findings so far have been inconsistent, Lee and colleagues reported in the Journal of Neurology Neurosurgery and Psychiatry.
The researchers compared the cognitive performance of more than 3,000 European men aged 40 to 79 and found those with low vitamin D levels did more poorly on a task designed to test mental agility.
The findings are some of the strongest evidence yet of such a link because of the size of the study and because the researchers adjusted for a number of lifestyle factors believed to affect mental ability when older, Lee said.
"We were able to take into account their educational level, their depression, their levels of physical activity and measures of physical performance," he said.
"When we adjusted for all these other health and lifestyle factors we still found that there was a link between vitamin D and the cognitive outcome."
The researchers do not know exactly how vitamin D and mental agility may be connected but said possible suggestions include the vitamin's role in increasing certain hormonal activity or the protection of neurons in the brain.
They also stressed their findings should not spur people to bask in the sun, which can increase the risk of skin cancer.
Source: msnbc