Background To assess the association of metformin monotherapy with the risk of all-cause deaths and cardiovascular deaths and events in type 2 diabetes patients in real clinical practice. Methods This retrospective, observational study comprised patients with type 2 diabetes initially treated with metformin or nonmetformin monotherapy over 2011-2016. Data were extracted from the National Healthcare Big Data database in Fuzhou, China. Propensity score matching (PSM) was performed, matching each patient on metformin to one on nonmetformin in terms of a set of covariates. The primary endpoint was all-cause death, and secondary endpoints were cardiovascular death, heart failure, and heart failure hospitalization. Covariate-adjusted associations of metformin use with all the endpoints were assessed by Cox proportional hazards models. Results Among 24,099 patients, 5491 were initially treated with metformin and 18,608 with nonmetformin. PSM yielded 5482 patients in each cohort. During a median follow-up of 2.02 years, we observed 110 and 211 deaths in the metformin and nonmetformin groups, respectively. Metformin was significantly associated with reduced risk of all-cause death (adjusted hazard ratio (aHR) 0.52, 95% confidence interval (CI) 0.39-0.69), cardiovascular death (aHR 0.63, 95% CI 0.43-0.91), and heart failure (aHR 0.61, 95% CI 0.52-0.73), whereas the reduced risk in heart failure hospitalization was not statistically significant (aHR 0.70, 95% CI 0.47-1.02). Conclusions In this analysis of electronic health record data from a large database in China, metformin as first-line monotherapy greatly reduced the risk of all-cause death, cardiovascular death, and heart failure in diabetes patients as compared with nonmetformin medications.