Introduction: Patients with cancer face a heightened risk of cardiovascular (CV) events and mortality. Sodium-glucose cotransporter 2 inhibitors (SGLT2i) reduce CV events in at-risk patients and may possess antitumor effects. Therefore, we examined the effect of SGLT2i on CV events and mortality among patients with cancer and diabetes. Methods: This was a retrospective propensity score-matched cohort study conducted at two tertiary referral centers in Taiwan. We included all adult patients with type 2 diabetes mellitus diagnosed with cancer between January 2010 and December 2021. The primary outcomes were hospitalization for incident heart failure (HF) and all-cause mortality. The secondary outcomes were a composite of myocardial infarction, ischemic stroke, and cardiac arrhythmias, and serious adverse events associated with SGLT2i. Results: From a total of 8640 patients, 878 SGLT2i-recipients were matched to non-recipients. During a median follow-up period of 18.8 months, SGLT2i recipients had a lower rate of hospitalization for incident HF compared with non-SGLT2i recipients (2.92 vs. 8.95 per 1000 patient-years, p=0.018). In both Cox regression and competing regression models, SGLT2i were associated with a 70% reduction in the risk for hospitalization for incident HF (HR, 0.28 [95% CI: 0.11-0.77], p = 0.013; SHR, 0.32 [95% CI: 0.12-0.84], p = 0.021). The use of SGLT2i was associated with a higher overall survival (85.3% vs. 63.0% at 2 years, p<0.001). The risk of myocardial infarction, ischemic stroke, cardiac arrhythmias, and serious adverse events such as hypoglycemia, urosepsis, and sepsis was similar between the SGLT2i and non-SGLT2i cohorts. Conclusions: The use of SGLT2i was associated with a lower rate of hospitalization for incident HF and prolonged overall survival in cancer patients with diabetes mellitus.