Coffee is among the most consumed beverages worldwide. Coffee consumption has been associated with lower risk of type 2 diabetes mellitus (T2D), but underlying mechanisms are not well understood. We aimed to study the role of classic and novel-T2D biomarkers with anti- or pro-inflammatory activity in the association between habitual coffee intake and T2D risk. Furthermore, we studied differences by coffee types and smoking status in this association. Using two large population-based cohorts, the UK-Biobank (UKB; n=145,368) and the Rotterdam Study (RS; n=7111), we investigated associations of habitual coffee consumption with incident T2D and repeated measures of insulin resistance (HOMA-IR), using Cox proportional hazards and mixed effect models, respectively. Additionally, we studied associations between coffee and subclinical inflammation biomarkers including C-reactive protein (CRP) and IL-13, and adipokines, such as adiponectin and leptin, using linear regression models. Next, we performed formal causal mediation analyses to investigate the role of coffee-associated biomarkers in the association of coffee with T2D. Finally, we evaluated effect modification by coffee type and smoking. All models were adjusted for sociodemographic, lifestyle and health-related factors. During a median follow-up of 13.9 (RS) and 7.4 (UKB) years, 843 and 2290 incident T2D cases occurred, respectively. A 1 cup/day increase in coffee consumption was associated with 4% lower T2D risk (RS, HR=0.96 [95%CI 0.92; 0.99], p=0.045; UKB, HR=0.96 [0.94; 0.98], p<0.001), with lower HOMA-IR (RS, log-transformed β=-0.017 [-0.024;-0.010], p<0.001), and with lower CRP (RS, log-transformed β=-0.014 [-0.022;-0.005], p=0.002; UKB, β=-0.011 [-0.012;-0.009], p<0.001). We also observed associations of higher coffee consumption with higher serum adiponectin and IL-13 concentrations, and with lower leptin concentrations. Coffee-related CRP levels partially mediated the inverse association of coffee intake with T2D incidence (average mediation effect RS β=0.105 (0.014; 0.240), p=0.016; UKB β=6.484 (4.265; 9.339), p<0.001), with a proportion mediated by CRP from 3.7% [-0.012%; 24.4%] (RS) to 9.8% [5,7%; 25.8%] (UKB). No mediation effect was observed for the other biomarkers. Coffee-T2D and coffee-CRP associations were generally stronger among consumers of ground (filtered or espresso) coffee and among never and former smokers. Lower subclinical inflammation may partially mediate the beneficial association between coffee consumption and lower T2D risk. Consumers of ground coffee and non-smokers may benefit the most. KEYWORDS (MESH TERMS): coffee consumptions; diabetes mellitus, type 2; inflammation; adipokines; biomarkers; mediation analysis; follow-up studies.