In a population-based cohort study of all women aged over 50 years with breast cancer in the Swedish Cancer Register in 1961-2003, those diagnosed before 31 December 1987 were regarded as unexposed to tamoxifen, whereas those diagnosed after that date were considered potentially exposed. Crosslinkages within the Cancer Register and the Registers of Death and Emigration enabled follow-up. Standardised incidence ratios (SIRs) of oesophageal and gastric cancer represented relative risks. Among 138 885 cohort members contributing with 1 075 724 person-years of follow-up, we found a nonsignificantly increased risk of oesophageal adenocarcinoma during the potential tamoxifen exposure period (SIR 1.60, 95% confidence interval (CI) 0.83-3.08), but the risk estimates decreased with increasing latency interval. No association was observed during the unexposed period. No increased risk of cardia adenocarcinoma was identified in either period. The risk of non-cardia gastric adenocarcinoma was increased in the potential tamoxifen period (SIR 1.27, 1.03-1.57), and almost doubled (SIR 1.86, 95% CI 1.10-3.14) in the period of longest latency (10-14 years). The corresponding overall SIR was increased in the unexposed group also, but here SIR did not increase with longer latency intervals. An increased risk of tobacco-related tumours, that is, oesophageal squamous-cell carcinoma and lung cancer, was limited to the unexposed cohort, indicating that confounding by smoking might explain the increased SIR during the unexposed period. We concluded that there might be a link between tamoxifen and risk of non-cardia gastric adenocarcinoma.