Brain oxidative processes play a major role in age-related cognitive decline, thus consumption of antioxidant-rich foods might help preserve cognition. Our aim was to assess whether consumption of antioxidant-rich foods in the Mediterranean diet relates to cognitive function in the elderly. In asymptomatic subjects at high cardiovascular risk (n = 447; 52% women; age 55–80 y) enrolled in the PREDIMED study, a primary prevention dietary-intervention trial, we assessed food intake and cardiovascular risk profile, determined apolipoprotein E genotype, and used neuropsychological tests to evaluate cognitive function. We also measured urinary polyphenols as an objective biomarker of intake. Associations between energy-adjusted food consumption, urinary polyphenols, and cognitive scores were assessed by multiple linear regression models adjusted for potential confounders. Consumption of some foods was independently related to better cognitive function. The specific associations [regression coefficients (95% confidence intervals)] were: total olive oil with immediate verbal memory [0.755 (0.151–1.358)]; virgin olive oil and coffee with delayed verbal memory [0.163 (0.010–0.316) and 0.294 (0.055–0.534), respectively]; walnuts with working memory [1.191 (0.061–2.322)]; and wine with Mini-Mental State Examination scores [0.252 (0.006–0.496)]. Urinary polyphenols were associated with better scores in immediate verbal memory [1.208 (0.236–2.180)]. Increased consumption of antioxidant-rich foods in general and of polyphenols in particular is associated with better cognitive performance in elderly subjects at high cardiovascular risk. The results reinforce the notion that Mediterranean diet components might counteract age-related cognitive decline.