Background: Patients with advanced gastroesophageal cancer refractory to previous regimen of chemotherapy suffered from poor prognosis without many effective treatment options. Immune checkpoint inhibitors (ICIs) provide promising efficacy, but the relevant clinical trials have offered controversial data. Therefore, we performed this meta-analysis to compare the efficacy and safety of inhibitors against programmed cell death receptor 1 (PD-1) and its ligand PD-L1 versus chemotherapy as second or third-line therapy in patients with advanced gastroesophageal cancer.Materials and methods: We systematically searched PubMed, Cochrane Library, Web of Science, Embase, and China National Knowledge Web. All studies regarding ICIs compared chemotherapy for advanced gastroesophageal cancer were included. Outcomes included the overall survival (OS),progression-free survival (PFS), objective response rate (ORR) and treatment-related adverse events (TRAEs). The hazard ratio (HR) and odds ratio (OR) were the principal measure of effect.Results: Finally we selected 7 randomized controlled trials (RCTs) including 3,141 patients. One study compared ICIs with placebo therapy only as reference. The meta-analysis was performed by combining 6 RCTs about the comparing ICIs with chemotherapy. Results indicated that both ORR (RR = 1.39, 95%CI 0.85-2.25, P = 0.188) and PFS (HR = 1.14, 95%CI 0.88-1.46, P = 0.316) were not significantly improved by ICIs compared with chemotherapy. However, the OS was significantly prolonged (HR = 0.85, 95%CI 0.75-0.97, P = 0.018) in ICIs group compared with chemotherapy. Subgroup analysis showed that ICIs provide statistically significant OS benefits over chemotherapy in patients of PD-L1 positive, squamous cell carcinoma, Asia origin, esophageal cancer, second-line treatment, male and patients aged 65 or older. Compared with chemotherapy, the TRAEs risk of ICIs was reduced by 33% (RR = 0.67, 95%CI 0.62-0.73, P = 0.000). And the risk of grade 3-5 TRAEs was reduced by 60% (RR = 0.40, 95%CI 0.33-0.49, P = 0.000). Conclusions: Compared to chemotherapy, ICIs appears to improve OS and are better tolerated in previously treated patients with advanced esophageal cancer. We recommend PD-1/PD-L1 inhibitors as an optimal treatment option for patients with positive PD-L1 expression, squamous cell carcinoma, Asia origin, esophageal cancer, second-line treatment, male and ≥65 years of age.