Survivors of myocardial infarction have an elevated risk of long-term mortality. We sought to evaluate guideline-directed medical treatment and its impact on long-term mortality in survivors of ST-elevation myocardial infarction (STEMI) according to their chronic kidney disease (CKD) stage. Using German health insurance claims data, 157663 hospitalized survivors of STEMI were identified. Regarding different CKD stages, we retrospectively analysed the filled prescriptions of platelet inhibitors (PAI)/oral anticoagulation, statins, beta-blocker and angiotensin-converting enzyme inhibitors/angiotensin II type 1 receptor antagonists (ACE-I/AT1-A) and their association with long-term mortality. Prescription rates for all four guideline-directed drugs were highest in patients without or with mild CKD and lowest in patients on dialysis. They dropped from 73.4% to 39.2% in patients without CKD and from 47.1% to 29% in patients on dialysis within the 5-year follow-up period. Mortality rates were dramatically increased in patients with CKD compared with patients without CKD (5-year mortality: no CKD, 16.7%; CKD stage 3, 47.1%; CKD stage 5d, 69.7%). Filled prescriptions of at least one drug class [one drug: hazard ratio (HR) 0.70, 95% confidence interval (95% CI) 0.66-0.74; four drugs: HR 0.28, 95% CI 0.27-0.30; P<.001 for both] as well as the distinct drug classes (statins: HR 0.55, 95% CI 0.54-0.56; ACE-I/AT1-A: HR 0.68, 95% CI 0.67-0.70; beta-blocker: HR 0.87, 95% CI 0.85-0.90; PAI/oral anticoagulation: HR 0.97, 95% CI 0.95-1.00; all P<.05) improved long-term mortality. An improved long-term guideline-recommended drug therapy after STEMI regardless of renal impairment might lead to beneficial effects on long-term mortality.