Some investigations suggest a better prognosis in women compared to men with esophageal cancer but these differences are uncertain. The aim of our study was to clarify whether sex influences the prognosis after esophagectomy for esophageal squamous cell carcinoma and esophageal adenocarcinoma. A population-based and nationwide cohort study included almost all patients who underwent esophagectomy for esophageal cancer in Sweden in 1987-2010, with follow-up until 2016. Patients' sex was analyzed in relation to risk of mortality. Multivariable Cox regression provided hazard ratios (HR) with 95% confidence intervals (CI), adjusted for calendar period, age, education, comorbidity, tumor stage, neoadjuvant therapy, and surgeon volume. Among 1,816 participants, 1,024 (56%) had esophageal squamous cell carcinoma (355 [35%] women), and 792 (44%) had esophageal adenocarcinoma (103 [13%] women). Compared to men, women had a decreased overall all-cause mortality in esophageal squamous cell carcinoma (HR = 0.73, 95% CI 0.63-0.85). Stratified analyses showed decreased mortality limited to women aged >55 years (HR = 0.71, 95% CI 0.61-0.83), but in all tumor stages, particularly stages 0-I (HR = 0.54, 95% CI 0.37-0.79). Women also had decreased 90-day all-cause mortality, 5-year all-cause mortality, and 5-year disease-specific mortality in esophageal squamous cell carcinoma compared to men. For esophageal adenocarcinoma, no sex differences were found for any of the mortality outcomes. Thus, women who undergo esophagectomy for esophageal squamous cell carcinoma seem to have better prognosis than men, especially those with early tumor stages, whereas no sex differences in prognosis were found for esophageal adenocarcinoma.