The objective of this study was to examine the relationship between total trihalomethanes (TTHM) levels in public water supplies and risk of pancreatic cancer and to determine whether calcium (Ca) and magnesium (Mg) levels in drinking water modify the effects of TTHM on risk to develop pancreatic cancer. A matched case-control study was used to investigate the relationship between the risk of death attributed to pancreatic cancer and exposure to TTHM in drinking water in 53 municipalities in Taiwan. All pancreatic cancer deaths in the 53 municipalities from 1998 through 2007 were obtained from the Bureau of Vital Statistics of the Taiwan Provincial Department of Health. Controls were deaths from other causes and were pair matched to the cancer cases by gender, year of birth, and year of death. Each matched control was selected randomly from the set of possible controls for each cancer case. Data on TTHM levels in drinking water were collected from Taiwan Environmental Protection Administration. Information on the levels of Ca and Mg in drinking water was obtained from the Taiwan Water Supply Corporation. The municipality of residence for cancer cases and controls was presumed to be the source of the subject's TTHM, Ca, and Mg exposure via drinking water. Relative to individuals whose TTHM exposure level<4.9 ppb, the adjusted OR (95% CI) for pancreatic cancer was 1.01 (0.85-1.21) for individuals who resided in municipalities served by drinking water with a TTHM exposure>4.9 ppb. There was no evidence of an interaction of drinking water TTHM levels with low Ca intake via drinking water. However, we observed evidence of an interaction between drinking water TTHM concentrations and Mg intake via drinking water. Our findings showed that the correlation between TTHM exposure and risk of pancreatic cancer is influenced by Mg in drinking water. Increased knowledge of the interaction between Mg and TTHM in reducing pancreatic cancer risk will aid in public policy making and standard setting.