Prospective epidemiologic data on vegetables and fruits consumption and risk of subtypes of esophageal and gastric cancer are sparse. We studied the association between vegetables and fruits consumption and risk of esophageal squamous cell carcinoma (ESCC), esophageal adenocarcinoma (EAC), gastric cardia adenocarcinoma (GCA) and gastric noncardia adenocarcinoma (GNCA) in the Netherlands Cohort Study. In 1986, 120,852 Dutch men and women aged 55-69 filled out a questionnaire on diet and other cancer risk factors. After 16.3 years of follow-up, 101 ESCC, 144 EAC, 156 GCA, 460 GNCA cases and 4,035 subcohort members were available for case-cohort analysis using Cox proportional hazards models. Multivariable adjusted incidence rate ratios (RRs) were generally below unity. Total vegetable consumption was nonsignificantly inversely associated with EAC and ESCC risk, but not with GCA and GNCA risk. Significant inverse associations were observed for raw vegetables and EAC risk [RR per 25 g/day: 0.81, 95% confidence interval (CI) 0.68-0.98], and Brassica vegetables and GCA risk (RR per 25 g/day: 0.72, 95% CI 0.54-0.95). Total fruit consumption was associated with a nonsignificantly decreased EAC risk. Citrus fruits were inversely associated with EAC and GCA risk (RRs for highest vs. lowest intake: 0.55, 95% CI 0.31-0.98 and 0.38, 95% CI 0.21-0.69, respectively). Specifically for current smokers, vegetables and possibly also fruits intake was inversely associated with ESCC and EAC risk. Consumption of (specific groups of) vegetables and fruits may protect against subtypes of esophageal and gastric cancer.