Eating mushrooms more than twice a week could prevent memory and language problems occurring in the over-60s, research from Singapore suggests.
A unique antioxidant present in mushrooms could have a protective effect on the brain, the study found.
The more mushrooms people ate, the better they performed in tests of thinking and processing.
But researchers said it was not possible to prove a direct link between the fungi and brain function.
The National University of Singapore study's findings were based on 663 Chinese adults, aged over 60, whose diet and lifestyle were tracked from 2011 to 2017.
Over the six-year study, the researchers found that eating mushrooms lowered the chances of mild cognitive impairment, so that roughly nine out of 100 people who ate more than two portions a week were diagnosed, compared with 19 out of 100 among those who ate fewer than one portion.
Mild cognitive impairment (MCI) can make people forgetful, affect their memory and cause problems with language, attention and locating objects in spaces - but the changes can be subtle.
It is not serious enough to be defined as dementia.
The participants in the study were asked how often they ate six different types of mushrooms: oyster, shiitake, white button, dried, golden and tinned.
Mushroom eaters performed better in brain tests and were found to have faster processing speed - and this was particularly noticeable in those who ate more than two portions a week, or more than 300g (10.5oz).
"This correlation is surprising and encouraging," said assistant professor Lei Feng, the lead study author, from the university's department of psychological medicine.
"It seems that a commonly available single ingredient could have a dramatic effect on cognitive decline.
"But we are talking about a combination of many factors - tea, green leafy vegetables, nuts and fish are also beneficial."
The researchers point to the fact that mushrooms are one of the richest dietary sources of ergothioneine - an antioxidant and anti-inflammatory which humans are unable to make on their own.
Mushrooms also contain other important nutrients and minerals such as vitamin D, selenium and spermidine, which protect neurons from damage.
But there is still a long way to go before evidence of a direct link can be established.
Diet and lifestyle factors
This study relied on self-reported information on mushroom intake and other dietary factors, which may not be accurate, the researchers acknowledged.
Dr James Pickett, head of research at Alzheimer's Society, said: "There are lots of factors that contribute to the development of dementia and it's estimated that up to a third of cases could be prevented by changes in lifestyle, including diet.
"Dementia is one of the top 10 causes of death, but people can take action to reduce their risk, so it's important that we base our advice on consistent evidence that's built up over multiple studies, and don't get carried away with the findings of any one single study.
"So while eating a diet full of fruit and vegetables, including mushrooms, is a great starting point, our best advice is to also cut down on sugar and salt, be physically active, drink in moderation and avoid smoking."