We investigated the importance of magnesium and calcium in drinking water in relation to morbidity and mortality from acute myocardial infarction. Cases were men and women 50-74 years of age living in 18 Swedish municipalities who had suffered an acute myocardial infarction some time between October 1, 1994, and June 30, 1996. Controls were randomly selected from the same study base. We interviewed the surviving cases (N = 823) and controls (N = 853), focusing on risk factors for acute myocardial infarction. We collected individual data on drinking water levels of magnesium and calcium. We classified subjects by quartile of water magnesium or calcium levels. The total number of cases was similar in the four quartiles. The risk of death was 7.6% (95% confidence interval = 2.1-13.1) lower in the quartile with high magnesium levels (> or = 8.3 mg/liter). The odds ratio for death from acute myocardial infarction in relation to water magnesium was 0.64 (95% confidence interval = 0.42-0.97) for the highest quartile relative to the three lower ones. Multivariate analyses showed that other risk factors were not important confounders. For calcium, this study was inconclusive. The data suggest that magnesium in drinking water is associated with lower mortality from acute myocardial infarction, but not with the total incidence.