Prospective studies examining the association between coffee and tea consumption and gastric cancer risk have shown inconsistent results. We investigated the association between coffee (total, caffeinated and decaffeinated) and tea consumption and the risk of gastric cancer by anatomical site and histological type in the European Prospective Investigation into Cancer and Nutrition study. Coffee and tea consumption were assessed by dietary questionnaires at baseline. Adjusted hazard ratios (HRs) were calculated using Cox regression models. During 11.6 years of follow up, 683 gastric adenocarcinoma cases were identified among 477,312 participants. We found no significant association between overall gastric cancer risk and consumption of total coffee (HR 1.09, 95%‐confidence intervals [CI]: 0.84–1.43; quartile 4 vs. non/quartile 1), caffeinated coffee (HR 1.14, 95%‐CI: 0.82–1.59; quartile 4 vs. non/quartile 1), decaffeinated coffee (HR 1.07, 95%‐CI: 0.75–1.53; tertile 3 vs. non/tertile 1) and tea (HR 0.81, 95%‐CI: 0.59–1.09; quartile 4 vs. non/quartile 1). When stratified by anatomical site, we observed a significant positive association between gastric cardia cancer risk and total coffee consumption per increment of 100 mL/day (HR 1.06, 95%‐CI: 1.03–1.11). Similarly, a significant positive association was observed between gastric cardia cancer risk and caffeinated coffee consumption (HR 1.98, 95%‐CI: 1.16–3.36, p‐trend=0.06; quartile 3 vs. non/quartile 1) and per increment of 100 mL/day (HR 1.09, 95%‐CI: 1.04–1.14). In conclusion, consumption of total, caffeinated and decaffeinated coffee and tea is not associated with overall gastric cancer risk. However, total and caffeinated coffee consumption may be associated with an increased risk of gastric cardia cancer. Further prospective studies are needed to rule out chance or confounding.