Background Percutaneous coronary intervention (PCI) reduces mortality in most myocardial infarction (MI) patients but the effect on elderly patients with comorbidities is unclear. Our aim was to analyse the effect of PCI on in-hospital mortality of MI patients, by age, sex, ST elevation on presentation, diabetes mellitus (DM) and chronic kidney disease (CKD). Methods Cohort study of 79,791 MI patients admitted at European hospitals during 2000–2014. The effect of PCI on in-hospital mortality was analysed by age group (18–74, ≥ 75 years), sex, presence of ST elevation, DM and CKD, using propensity score matching. The number needed to treat (NNT) to prevent a fatal event was calculated. Sensitivity analyses were conducted. Results PCI was associated with lower in-hospital mortality in ST and non-ST elevation MI (STEMI and NSTEMI) patients. The effect was stronger in men [Odds ratio (95% confidence interval) 0.30 (0.25–0.35)] than in women [0.46 (0.39–0.54)] aged ≥ 75 years, and in NSTEMI [0.22 (0.17–0.28)] than in STEMI patients [0.40 (0.31–0.5)] aged < 75 years. PCI reduced in-hospital mortality risk in patients with and without DM or CKD (54–72% and 52–73% reduction in DM and CKD patients, respectively). NNT was lower in patients with than without CKD [≥ 75 years: STEMI = 6(5–8) vs 9(8–10); NSTEMI = 10(8–13) vs 16(14–20)]. Sensitivity analyses such as exclusion of hospital stays < 2 days yielded similar results. Conclusions PCI decreased in-hospital mortality in MI patients regardless of age, sex, and presence of ST elevation, DM and CKD. This supports the recommendation for PCI in elderly patients with DM or CKD.