BackgroundEvidence is limited and inconsistent regarding vitamin D and heart failure (HF) risk in people with type 2 diabetes (T2D), among whom vitamin D insufficiency or deficiency is common. ObjectiveThis study aimed to investigate the associations of serum 25-hydroxyvitamin D (25[OH]D) with HF risk among individuals with T2D, in observational and Mendelian randomization (MR) frameworks. MethodsObservational analyses were performed among 15,226 T2D participants aged 40–72 from the UK Biobank. HF incidence was ascertained through electronic health records. Cox proportional hazard regression models were used to estimate hazard ratios (HRs) and 95% confidence intervals (CIs) for the association between serum 25(OH)D and HF risk among people with T2D. MR analyses were conducted among 11,260 unrelated participants with T2D. A weighted genetic risk score (GRS) for genetically predicted 25(OH)D concentration was instrumented using 62 confirmed genome-wide variants. ResultsThe mean ± standard deviation of serum 25(OH)D was 43.4 ± 20.4 nmol/L. During a median follow-up of 11.3 years, 836 incident HF events occurred. Serum 25(OH)D was nonlinearly and inversely associated with HF and the decreasing risk tended to plateau at around 50 nmol/L. Comparing those with 25(OH)D <25 nmol/L, the multivariable-adjusted HR (95% CI) was 0.67 (0.54, 0.83) for participants with 25(OH)D of 50.0–74.9 nmol/L and was 0.71 (0.52, 0.98) for 25(OH)D >75 nmol/L. In MR analysis, each 7% increment in genetically predicted 25(OH)D was associated with 36% lower risk of HF among people with T2D (HR: 0.64, 95% CI: 0.41, 0.99). Conclusions/interpretationHigher serum 25(OH)D was associated with lower HF risk among individuals with T2D and the MR analysis suggested a potential causal relationship. These findings indicate a role of maintaining adequate vitamin D status in the prevention of HF among individuals with T2D.