Background: The relation of coffee consumption with total mortality is controversial, because the available evidence is still inconsistent. Objective: This study aimed to assess this association in a highly educated, middle-aged Mediterranean cohort. Design: We analyzed data from 201,055 person-years of follow-up arising from 19,888 participants. Coffee consumption was obtained at baseline with the use of a previously validated semi-quantitative food-frequency questionnaire. Information on mortality was ascertained by permanent contact with the "Seguimiento Universidad de Navarra" (SUN) participants and their families, postal authorities, and consultation of the National Death Index. We used Cox regression models to estimate HRs and 95% CIs for mortality according to baseline total coffee consumption adjusted for potential confounders. Sex, age, and baseline adherence to the Mediterranean diet were considered as potential effect modifiers. Results: Among the 19,888 participants, 337 died. Overall, in the multivariable adjusted analysis, we found a 22% lower risk of all-cause mortality for each 2 additional cups of total coffee per day (HR: 0.78; 95% CI: 0.66, 0.93). This association was stronger for participants aged >= 55 y (HR: 0.67; 95% CI: 0.52, 0.86) than for younger participants, who showed no significant association (P-interaction = 0.002). Conclusion: In a Mediterranean cohort, we found an inverse linear association between total coffee consumption and the risk of all-cause mortality that was strongest among participants older than 54 y.