Abstract Background Statins have been reported to prevent adverse cardiovascular events in patients with myocardial infarction (MI). However, the association of statin use and the risk of pneumonia requiring hospitalization in MI patients remains unclear. Methods A nested case-control study was conducted by using data from the National Health Insurance Research Database of Taiwan. Among 24,975 patients with MI, 2686 case patients with pneumonia requiring hospitalization were age- and sex-matched with 10,726 control patients using the incidence density sampling approach. Duration and dosage of statin use were obtained from pharmaceutical claims. Conditional logistic regression analyses were used to estimate the risk of hospitalization for pneumonia associated with statin use adjusted for patient’s demographics, medical conditions and prescribed medications. Results Statin use was associated with a 15 % reduced risk of pneumonia requiring hospitalization among MI patients (adjusted odds ratio [aOR] = 0.85, 95 % confidence interval [CI] = 0.77–0.95, P = 0.004). The association was more significant for MI patients unexposed to statin pretreatment (aOR = 0.76, 95 % CI = 0.64–0.90, P = 0.001). Statins also exhibited favorable benefits in a time- and dose-dependent manner. The results were consistent in various subgroup analysis of the patients who were female, age ≥ 65 years, a low CHADS2 (i.e. congestive heart failure, hypertension, diabetes mellitus, previous stroke and age > 75 years old) score, and fewer comorbidities. Atorvastatin, fluvastatin and simvastatin were the most common prescribed statins and had similar effects. Conclusions Statins might be considered as an adjunctive therapy to reduce the risk of hospitalization for pneumonia for MI patients under thorough evaluation of individual comorbidities, previous statin use and optimal dosage.