The study of 15,093 people suggests depression could be linked with nutrient deficits.
The researchers compared three diets; the Mediterranean diet, the Pro-vegetarian Dietary Pattern and Alternative Healthy Eating Index-2010.
Participants used a scoring system to measure their adherence to the selected diet, ie the higher the dietary score indicated that the participant was eating a healthier diet.
Food items such as meat and sweets (sources of animal fats: saturated and trans fatty acids) were negatively scored, while nuts, fruits and vegetables (sources of omega-3 fatty acids, vitamins and minerals respectively) were positively scored.
More From This Section
"These diets are all associated with physical health benefits and now we find that they could have a positive effect on our mental health," said Sanchez-Villegas.
"The protective role is ascribed to their nutritional properties, where nuts, legumes, fruits and vegetables (sources of omega-3 fatty acids, vitamins and minerals) could reduce the risk of depression," said Sanchez-Villegas.
The study included 15,093 participants free of depression at the beginning of the study.
All are part of the SUN (Seguimiento Universidad de Navarra) Project, a cohort study started on 21st December 1999.
The cohort has been used to identify dietary and lifestyle determinants of various conditions, including diabetes, obesity and depression.
Questionnaires to assess dietary intake were completed at the start of the project and again after 10 years.
A total of 1,550 participants reported a clinical diagnosis of depression or had used antidepressant drugs after a median follow-up of 8.5 years.
The Alternative Healthy Eating Index-2010 was associated with the greatest reduction of risk of depression but most of the effect could be explained by its similarity with the Mediterranean Diet.