Abstract Background Recent phase III randomized controlled trials have demonstrated that first-line immune checkpoint inhibitors (ICIs) improve prognosis in advanced HER-2-negative gastric cancer patients with programmed death ligand 1 (PD-L1) combined positive score (CPS) higher than 5. However, these findings are not confirmed in real-world settings, and the benefits in PD-L1 CPS < 5 patients remain controversial. Methods In this multicenter, retrospective cohort study, data from across thirteen medical centers were analyzed by inverse probability of treatment weighting for matching, alongside univariate and multivariate COX proportional hazard regression models. Genomic and transcriptomic analyses were conducted to identify efficacy prognostic models and resistance mechanisms. Results This study included 573 patients with advanced gastric cancer, 265 treated with chemotherapy and 308 with ICIs plus chemotherapy. In the overall cohort and HER-2-negative patients, the combination therapy significantly improved progression-free survival and overall survival, without marked increases in severe adverse events. Notably, patients with PD-L1 CPS 1–4 showed significant overall survival prolongation and a trend towards improved progression-free survival with combination therapy. Patients with unknown PD-L1 status also benefitted from ICIs. SMARCA4 and BRCA2 mutations were more frequent in patients with responses, while CCNE1 and ZFHX3 alternation, alongside high “ABC transporters” signatures, were more common in non-responsive patients. A novel risk model, PGFIC, outperformed traditional biomarkers in predicting treatment outcomes. Conclusions Adding ICIs to first-line treatment significantly prolongs survival in overall patients and in those with PD-L1 CPS 1–4 or unknown. This study also provides valuable insights into prognostic markers and resistance mechanisms, potentially guiding immunotherapy strategies. Supplementary Information The online version contains supplementary material available at 10.1186/s12916-024-03801-5. Keywords: Gastric cancer, First-line treatment, Immune checkpoint inhibitor, Retrospective study, Multi-omics Background Gastric cancer (GC) is the fifth most common cancer and the fourth leading cause of cancer-related death worldwide [[81]1]. The regions with the highest GC incidence rates include Northeast Asia, South and Central America, and Eastern Europe [[82]2]. The insidious onset of GC often results in symptoms that are challenging to distinguish from benign diseases, leading to approximately 40% of patients being advanced stage at the initial diagnosis [[83]3]. In the past, chemotherapy was the standard first-line treatment for advanced GC but only yielded a 5-year survival rate of less than 20% and a median overall survival (mOS) of less than one year [[84]4]. The introduction of trastuzumab, targeting anti-human epidermal growth factor receptor-2 (HER-2), has improved the mOS to over fourteen months in patients with HER-2-amplified advanced GC [[85]5]. However, patients with HER-2 positivity represent only 7% to 34% of the entire GC population [[86]5]. In recent years, immune checkpoint inhibitor (ICIs) therapy has brought new hope to advanced GC, albeit in the face of various challenges. Several randomized controlled trials (RCTs) have shown that the combination of ICIs and chemotherapy significantly prolongs median progression-free survival (mPFS) and mOS in patients with advanced HER-2-negative GC, especially those with high programmed death ligand 1 (PD-L1) expression, as measured by the combined positive score (CPS) ≥ 5. [[87]6–[88]8] However, there were still negative survival outcomes in large RCTs in advanced GC, such as KEYNOTE-062. [[89]9]. In the ATTRACTION-4 trial, ICI combined with chemotherapy only achieved a significant benefit in PFS, but failed in OS, another primary endpoint [[90]10]. Whether patients with low CPS expression can benefit from immunotherapy remains a hotly debated topic in clinical practice. Current evidence supports favorable outcomes for first-line ICIs combined with chemotherapy compared to chemotherapy alone in RCTs for advanced GC, primarily obtained in studies with a large proportion of patients with PD-L1 CPS ≥ 5. However, there is insufficient evidence to determine whether patients with low PD-L1 CPS expression, including those with CPS < 1 or CPS 1–4, would benefit from immunotherapy [[91]9]. A simulated individual patient data analysis using the KMSubtraction tool found no significant benefit in PFS or OS for advanced GC patients with PD-L1 CPS 1–4 after immunotherapy [[92]11]. Actually, PD-L1’s predicting role is limited due to its substantial spatial and temporal heterogeneity, especially in small available samples that may not accurately represent the PD-L1 expression of the entire tumor [[93]12]. Furthermore, different methods for detecting PD-L1 expression also yield inconsistent results [[94]13]. Alongside PD-L1, other predictive biomarkers recommended in clinical practice, including microsatellite instability (MSI), tumor mutation burden (TMB), and Epstein-Barr virus (EBV) infection, also encounter limitations in terms of specificity or predictive efficacy [[95]12, [96]14, [97]15]. Therefore, further research is urgently needed to identify more effective biomarkers that can accurately guide treatment decisions for advanced GC. Recently, real-world studies have gained increasing attention for their broad patient inclusivity, closer alignment to clinical reality, and robust practical applicability [[98]16]. However, there remains an absence of large-scale real-world data addressing the efficacy, safety, and predictive markers for the first-line ICIs in combination with chemotherapy versus chemotherapy alone in advanced GC so far. To bridge this gap, we conducted a multicenter, retrospective study to validate the possible effectiveness of first-line immunotherapy in this population. Our research focused on the relationship between the efficacy of ICIs and the PD-L1 CPS in a real-world setting, paying special attention to patients with low or unknown CPS levels. Additionally, we explored potential molecular markers for predicting efficacy and investigating the mechanisms of resistance to ICIs through genetic sequencing analyses. Methods Study design and participants This multicenter, retrospective, controlled study was conducted in thirteen grade A tertiary hospitals in Shandong Province, China, including Qilu Hospital of Shandong University, Jinan Central Hospital, Linyi People's Hospital, Linyi Cancer Hospital, Affiliated Hospital of Qingdao University, Qingdao Municipal Hospital, Qilu Hospital of Shandong University (Qingdao), The First Affiliated Hospital of Shandong First Medical University, The Second Affiliated Hospital of Shandong First Medical University, Shandong Provincial Hospital, Weihai Municipal Hospital, Yantai Yuhuangding Hospital, and Zibo Center Hospital. Patients with advanced GC or gastro-esophageal junction cancer (GEJC) who began first-line treatment from January 1, 2018, to July 15, 2022, were enrolled and were followed up until December 31, 2022. Eligible patients were aged 18–85 years, with histologically confirmed gastric and gastro-esophageal junction adenocarcinoma, including metastatic or locally advanced GC/GEJC without operation indication, or recurrent GC/GEJC at least six months post adjuvant chemotherapy. Patients should have a minimum of two cycles of chemotherapy or chemotherapy combined with ICIs for their first-line therapy. Trastuzumab is allowed for patients with HER-2 positive tumor. Exclusion criteria include individuals with multiple primary tumors, as well as those lacking evaluable lesions or efficacy assessment. The decision to receive chemotherapy alone or chemotherapy plus ICI was determined by the physician, based on their clinical judgment, when ICIs were not yet a standardized first-line treatment for gastric cancer. This study followed the Strengthening the Reporting of Observational Studies in Epidemiology (STROBE) reporting guideline for observational studies. Data collection and assessment Patient information was collected through the electronic medical record system and follow-up visits at least every three months. Imaging results, including CT and MRI results within 28 days before the patient's initial treatment, were utilized as the baseline data for evaluating efficacy. Tumor responses were assessed according to Response Evaluation Criteria In Solid Tumors (RECIST) 1.1 criteria [[99]17], and categorized as complete response (CR), partial response (PR), stable disease (SD), or progressive disease (PD) for patients with measurable lesions, and as CR, non-PR/non-PD, or PD for patients without measurable lesions. The objective response rate (ORR) was defined as the proportion of patients achieving CR or PR. PFS was defined as the time interval from the initiation of first-line therapy to PD or death from any cause. OS was defined as the time interval from the initiation of first-line treatment to death for any reason. Adverse events were assessed throughout the study according to Common Terminology Criteria for Adverse Events (CTCAE) version 5.0 [[100]18]. PD-L1 CPS scoring was conducted using the 22C3 (73.7%) and SP263 (26.3%) antibody clones, primarily based on the preferences of the