Higher variety in fruit and vegetable intake has been associated with a lower risk of several chronic diseases. It remains unclear whether such associations exist relating to cognition. The authors examined associations between total quantity and variety in fruit and vegetable intake and cognitive function in a cross-sectional sample of 1412 Puerto Rican adults, aged 45–75 years from the Boston Puerto Rican Health Study, 2004–9. Fruit and vegetable intake was assessed with a FFQ. Cognitive function was measured with a battery of seven tests; the Mini Mental State Examination (MMSE) was administrated to assess global cognitive function. Greater variety, but not total quantity, of fruit and vegetable intake was associated with a higher MMSE score after multivariate adjustment (P for trend = 0·012). This association remained significant after further adjusting for total quantity of fruit and vegetable intake (P for trend = 0·018). High variety of fruit and vegetable intake was also associated with individual cognitive domains, including executive function, memory and attention (all P for trend < 0·05). Variety, more than total quantity, of fruit and vegetable intake may offer cognitive protection in middle-aged and older adults, but longitudinal studies are needed to clarify direction of causality.