A gene variation that helps people live to a ripe old age also appears to preserve memory and thinking power, US work suggests.
The gene variant alters blood cholesterol transport
The "longevity" gene alters the size of fatty cholesterol particles in the blood, making them bigger than normal.
This stops them causing the fatty build up in blood vessels that is linked with brain impairment, and deadly strokes and heart attacks, Neurology reports.
The study involved nearly 300 Ashkenazi Jews in their 70s, 80s and 90s.
The nonagenarians who possessed the longevity gene were twice as likely to have good brain function than those who did not have the gene variant.
Their performance on tests of memory and concentration was far superior.
Also, those who had reached a century were three times more likely to have the longevity gene variation than their 70-year-old counterparts.
Lead researcher Nir Barzilia, director of the Institute for Aging Research at Albert Einstein College of Medicine in New York, said the same gene variation might also protect against Alzheimer's dementia.
He said: "In studying these centenarians, we hope to learn what factors lessen their risk for diseases that affect the general population at a much younger age."
He said as well as the gene having a favorable effect on the vascular integrity of the aging brain, it could also have a positive action on the brain tissue itself.
The brain relies on a good blood supply to keep its functions and processes in top order.
About one person in every 10,000 reaches the age of 100.
Researchers have known that genes play a role because longevity often runs in families.
Scientists are working to develop drugs that can mimic the effect of the gene CETP.
An American woman is officially recognised as the world's oldest person, dying at the age of 116 earlier this month.
She assumed the title of world's oldest person following the death of Esther de Capovilla of Ecuador in August - also at the age of 116.
Her successor looks set to be Emiliano Mercado del Toro of Puerto Rico, who is 115, according to Robert Young, adviser to Guinness World Records.