This study aimed to examine the effect of a diabetes pay-for-performance (P4P) program on all-cause mortality in patients with newly diagnosed type 2 diabetes mellitus. Using a Taiwanese representative nationwide cohort, we recruited 5478 patients with newly diagnosed type 2 diabetes enrolled in the P4P program within 5 years after a diagnosis of diabetes between January 1, 2002 and December 31, 2010 and individuals not enrolled in the P4P program were recruited as the control group matched 1:1 with the study group. We used multivariate Cox proportional hazard models analysis to investigate the effect of the P4P program and adherence on all-cause mortality. A total of 250 patients died in the P4P group compared to 395 in the control group (mortality rate 104 vs 169 per 10,000 person-years, respectively, P < .0001). The control group also had more comorbidities. Patients enrolled in the P4P program demonstrated significant long-term survival benefits, of which the adjusted hazard ratio (aHR) for all-cause mortality was 0.58 [95% CI (0.48-0.69)]. In the study group, better adherence to the P4P program resulted in a greater reduction in mortality, with aHRs [95% CI] of 0.48 [0.38-0.62] and 0.36 [0.26-0.49] in subjects with a minimum 1-year and 2-year good P4P adherence, respectively. Participating in the P4P program within 5 years after the diagnosis of diabetes resulted in a significant reduction in all-cause mortality, and this effect was particularly pronounced in the patients with better adherence to the P4P program.