Several epidemiologic studies have shown an association between calcium and magnesium and coronary heart disease mortality and morbidity. In this small-area study, we examined the relationship between acute myocardial infarction (AMI) risk and content of Ca, Mg, and chromium in local groundwater in Finnish rural areas using Bayesian modeling and geospatial data aggregated into 10 km times symbol 10 km grid cells. Data on 14,495 men 35-74 years of age with their first AMI in the years 1983, 1988, or 1993 were pooled. Geochemical data consisted of 4,300 measurements of each element in local groundwater. The median concentrations of Mg, Ca, and Cr and the Ca:Mg ratio in well water were 2.61 mg/L, 12.23 mg/L, 0.27 microg/L, and 5.39, respectively. Each 1 mg/L increment in Mg level decreased the AMI risk by 4.9%, whereas a one unit increment in the Ca:Mg ratio increased the risk by 3.1%. Ca and Cr did not show any statistically significant effect on the incidence and spatial variation of AMI. Results of this study with specific Bayesian statistical analysis support earlier findings of a protective role of Mg and low Ca:Mg ratio against coronary heart disease but do not support the earlier hypothesis of a protective role of Ca.