Aims Prior studies demonstrated an association between hospital admission blood glucose and mortality in acute myocardial infarction (AMI). Because stress hyperglycemia ratio (SHR) has been suggested as a more reliable marker of stress hyperglycemia this study investigated to what extent SHR in comparison with admission blood glucose is associated with short- and long-term mortality in diabetic and non-diabetic AMI patients. Methods The analysis was based on 2,311 AMI patients aged 25–84 years from the population-based Myocardial Infarction Registry Augsburg (median follow-up time 6.5 years [IQR: 4.9–8.1]). The SHR was calculated as admission glucose (mg/dl)/(28.7 × HbA1c (%)—46.7). Using logistic and COX regression analyses the associations between SHR and admission glucose and mortality were investigated. Result Higher admission glucose and higher SHR were significantly and nonlinearly associated with higher 28-day mortality in AMI patients with and without diabetes. In patients without diabetes, the AUC for SHR was significantly lower than for admission glucose (SHR: 0.6912 [95%CI 0.6317–0.7496], admission glucose: 0.716 [95%CI 0.6572–0.7736], p-value: 0.0351). In patients with diabetes the AUCs were similar for SHR and admission glucose. Increasing admission glucose and SHR were significantly nonlinearly associated with higher 5-year all-cause mortality in AMI patients with diabetes but not in non-diabetic patients. AUC values indicated a comparable prediction of 5-year mortality for both measures in diabetic and non-diabetic patients. Conclusions Stress hyperglycemia in AMI patients plays a significant role mainly with regard to short-term prognosis, but barely so for long-term prognosis, underlining the assumption that it is a transient dynamic disorder that occurs to varying degrees during the acute event, thereby affecting prognosis.