Aims/hypothesis The aim of this study was to examine the association of consumption of coffee and tea, separately and in total, with risk of type 2 diabetes and which factors mediate these relations. Methods This research was conducted as part of the Dutch Contribution to the European Prospective Investigation into Cancer and Nutrition, which involves a prospective cohort of 40,011 participants with a mean follow-up of 10 years. A validated food-frequency questionnaire was used to assess coffee and tea consumption and other lifestyle and dietary factors. The main outcome was verified incidence of type 2 diabetes. Blood pressure, caffeine, magnesium and potassium were examined as possible mediating factors. Results During follow-up, 918 incident cases of type 2 diabetes were documented. After adjustment for potential confounders, coffee and tea consumption were both inversely associated with type 2 diabetes, with hazard ratios of 0.77 (95% CI 0.63-0.95) for 4.1-6.0 cups of coffee per day (p for trend=0.033) and 0.63 (95% CI: 0.47-0.86) for >5.0 cups of tea per day (p for trend=0.002). Total daily consumption of at least three cups of coffee and/or tea reduced the risk of type 2 diabetes by approximately 42%. Adjusting for blood pressure, magnesium, potassium and caffeine did not attenuate the associations. Conclusions/interpretation Drinking coffee or tea is associated with a lowered risk of type 2 diabetes, which cannot be explained by magnesium, potassium, caffeine or blood pressure effects. Total consumption of at least three cups of coffee or tea per day may lower the risk of type 2 diabetes.