Cardiovascular disease is the main cause of death in patients with chronic kidney disease (CKD). Here we measured temporal trends in treatment and mortality after myocardial infarction (MI) depending on kidney function at presentation in 12,087 patients admitted for MI to a coronary care unit from 1985 to 2008. The patients were categorized into those with normal kidney function (estimated glomerular filtration rate over 90 ml/min per 1.73 m(2)), and those with CKD as defined by Kidney Foundation practice guidelines, with 8632 patients (71%) at CKD stages 2-5. Use of evidence-based care increased over time in all CKD stages. Mortality rates fell over the entire time period. When comparing data from 2000-2008 to that from 1985-1990, adjusted 30-day mortality fell both in patients with CKD stages 4-5 (adjusted odds 0.33, 95% confidence interval 0.18-0.60) and in those without kidney impairment (adjusted odds 0.21, 95% confidence interval 0.10-0.42). This mortality decrease was sustained during long-term follow-up. There was no significant interaction between kidney function and decade of admission. Overall, median survival was over 20, 15, 8, and 1.8 years for patients with normal kidney function, stage 2, stage 3, and stage 4-5 CKD, respectively. Thus, during the past 25 years, treatment of patients with a MI improved substantially with a concomitant decline in mortality. Although our findings were similar for all stages of kidney function, the prognosis remains poor for patients with stage 4-5 CKD.