ImportanceBariatric surgery (BS) is associated with significantly reduced incidence of cardiovascular diseases and mortality in patients with obesity. However, whether BS can decrease major adverse cardiovascular events in patients with nonalcoholic fatty liver disease (NAFLD) remains poorly understood.ObjectiveTo investigate the association of BS with the incidence of adverse cardiovascular events and all-cause mortality in patients with NAFLD and obesity.Design, Setting, and ParticipantsThis was a large, population-based, retrospective cohort using data from the TriNetX platform. Adult patients with a body mass index (BMI, calculated as weight in kilograms divided by height in meters squared) of 35 or greater and NAFLD (without cirrhosis) who underwent BS between January 1, 2005, and December 31, 2021, were included. Patients in the BS group were matched with patients who did not undergo surgery (non-BS group) according to age, demographics, comorbidities, and medication by using 1:1 propensity matching. Patient follow-up ended on August 31, 2022, and data were analyzed in September 2022.ExposuresBariatric surgery vs nonsurgical care.Main Outcomes and MeasuresThe primary outcomes were defined as the first incidence of new-onset heart failure (HF), composite cardiovascular events (unstable angina, myocardial infarction, or revascularization, including percutaneous coronary intervention or coronary artery bypass graft), composite cerebrovascular disease (ischemic or hemorrhagic stroke, cerebral infarction, transient ischemic attack, carotid intervention, or surgery), and a composite of coronary artery procedures or surgeries (coronary stenting, percutaneous coronary intervention, or coronary artery bypass). Cox proportional hazards models were used to estimate hazard ratios (HRs).ResultsOf 152 394 eligible adults, 4693 individuals underwent BS; 4687 patients who underwent BS (mean [SD] age, 44.8 [11.6] years; 3822 [81.5%] female) were matched with 4687 individuals (mean [SD] age, 44.7 [13.2] years; 3883 [82.8%] years) who did not undergo BS. The BS group had significantly lower risk of new-onset of HF (HR, 0.60; 95% CI, 0.51-0.70), cardiovascular events (HR, 0.53; 95% CI, 0.44-0.65), cerebrovascular events (HR, 0.59; 95% CI, 0.51-0.69), and coronary artery interventions (HR, 0.47; 95% CI, 0.35-0.63) compared with the non-BS group. Similarly, all-cause mortality was substantially lower in the BS group (HR, 0.56; 95% CI, 0.42-0.74). These outcomes were consistent at follow-up duration of 1, 3, 5, and 7 years.Conclusions and RelevanceThese findings suggest that BS was significantly associated with lower risk of major adverse cardiovascular events and all-cause mortality in patients with NAFLD and obesity.