Researchers discovered a "protective relationship" between having increased leg power and better preserved mental ability and brain structure over a period of 10 years.
The study, which was carried out using female twins, is believed to be the first to show a specific link between leg muscle force and brain performance in a normal, healthy population.
Scientists studied a sample of 324 female twins with an average age of 55 over a 10-year period from 1999, observing differing factors related to health and lifestyle, PA reports.
They did this because pairs of identical twins share the same genes and differences between them can be traced to environmental factors, such as keeping physically fit.
Thinking, learning and memory were measured at the beginning and end of the study, which was later published in the journal Gerontology.
The results showed that leg power was more closely linked to age-related changes in mental function than any other lifestyle factor tested.
Leg power was measured using a pedal-pushing machine. Generally, the twin who had stronger legs at the start of the study maintained her mental ability better as she got older.
She also preserved more "grey matter", which refers to part of the brain consisting of the bodies of nerve cells.
Lead scientist Dr Claire Steves, lecturer in twin research at King's College London, said: "Everyone wants to know how best to keep their brain fit as they age. Identical twins are a useful comparison, as they share many factors, such as genetics and early life, which we can't change in adulthood.
"It's compelling to see such differences in cognition and brain structure in identical twins, who had different leg power 10 years before. It suggests that simple lifestyle changes to boost our physical activity may help to keep us both mentally and physically healthy."
Previous research suggests that physical activity directly benefits the brain and studies in animals have shown that exercising muscles releases hormones that encourage nerve cells to grow.
More work is needed to investigate links between measurements of fitness such as leg power and brain changes, and the specific ways physical activity influences brain structure and mental capacity, say the scientists.
The mechanisms involved are not fully understood and could involve factors such as immune function, blood circulation and nerve signalling.
The team hope to conduct further research to establish whether the findings can be generalised to older or male populations.
The scientists concluded: "Leg power predicts both cognitive ageing and global brain structure, despite controlling for common genetics and early life environment shared by twins. Interventions targeted to improve leg power in the long term may help reach a universal goal of healthy cognitive ageing."
Dr Doug Brown, director of research at Alzheimer's Society, said: "This study adds to the growing evidence that physical activity can help you to look after your brain as well as your body, however we still don't fully understand how this relationship works and how we can maximise the benefit.
"By identifying which aspects of fitness and physical activity are important for the brain's health, we hope to be able to offer more specific advice on how you can reduce the risk of dementia."