Sodium-glucose cotransporter 2 inhibitor (SGLT2i) therapy has been associated with cardiovascular benefits and a few adverse events; however, whether the comparative effectiveness and safety profiles vary with differences in baseline hemoglobin A1c (HbA1c) levels is unknown. To compare cardiovascular effectiveness and safety of treatment with SGLT2i vs dipeptidyl peptidase 4 inhibitor (DPP-4i) in adults with type 2 diabetes (T2D) (1) overall and (2) at varying baseline HbA1c levels. A new-user comparative effectiveness and safety research study was conducted among 144 614 commercially insured adults, initiating treatment with SGLT2i or DPP-4i and with a recorded T2D diagnosis at baseline and at least 1 HbA1c laboratory result recorded within 3 months before treatment initiation. The intervention consisted of the initiation of treatment with SGLT2i or DPP-4i. Primary outcomes were a composite of myocardial infarction, stroke, or all-cause death (modified major adverse cardiovascular events [MACE]) and hospitalization for heart failure (HHF). Safety outcomes were hypovolemia, fractures, falls, genital infections, diabetic ketoacidosis (DKA), acute kidney injury (AKI), and lower-limb amputation. Incidence rate (IR) per 1000 person-years, hazard ratios (HR) and rate differences (RD) with their 95% CIs were estimated controlling for 128 covariates. A total of 144 614 eligible adults (mean [SD] age, 62 [12.4] years; 54% male participants) with T2D initiating treatment with a SGLT2i (n = 60 523) or a DPP-4i (n = 84 091) were identified; 44 099 had an HbA1c baseline value of less than 7.5%, 52 986 between 7.5% and 9%, and 47 529 greater than 9%. Overall, 87 274 eligible patients were 1:1 propensity score-matched: 24 052 with HbA1c less than 7.5%; 32 290 with HbA1c between 7.5% and 9%; and 30 932 with HbA1c greater than 9% (to convert percentage of total hemoglobin to proportion of total hemoglobin, multiply by 0.01). The initiation of SGLT2i vs DPP-4i was associated with a reduction in the risk of modified MACE (IR per 1000 person-years 17.13 vs 20.18, respectively; HR, 0.85; 95% CI, 0.75-0.95; RD, -3.02; 95% CI, -5.23 to -0.80) and HHF (IR per 1000 person-years 3.68 vs 8.08, respectively; HR, 0.46; 95% CI, 0.35 to 0.57; RD -4.37; 95% CI, -5.62 to -3.12) over a mean follow-up of 8 months, with no evidence of treatment effect heterogeneity across the HbA1c levels. Treatment with SGLT2i showed an increased risk of genital infections and DKA and a reduced AKI risk compared with DPP-4i. Findings were consistent by HbA1c levels, except for a more pronounced risk of genital infections associated with SGLT2i for HbA1c levels of 7.5% to 9% (IR per 1000 person-years 68.5 vs 22.8, respectively; HR, 3.10; 95% CI, 2.68-3.58; RD, 46.22; 95% CI, 40.54-51.90). In this comparative effectiveness and safety research study among adults with T2D, SGLT2i vs DPP-4i treatment initiators had a reduced risk of modified MACE and HHF, an increased risk of genital infections and DKA, and a lower risk of AKI, regardless of baseline HbA1c.