In this trial, the effectiveness and safety of nivolumab with gemcitabine were assessed for patients with nasopharyngeal carcinoma (NPC) who had previously been treated with platinum-based chemotherapy but had relapsed. The trial design is a single-arm, open-label, multicenter study in phase II. Nivolumab 3 mg/kg and gemcitabine 1,250 mg/m2 were administered every 2 weeks to patients with recurrent or metastatic NPC until disease progression or 7 toxicity. Progression-free survival (PFS) was the key measure of success. Objective Response Rate (ORR), Overall Survival (OS), and Safety Were Secondary Endpoints. Whole-exome sequencing, whole-transcriptome sequencing, and immunological phenotype analysis using Lunit SCOPE IO, a spatial tumor-infiltrating lymphocyte analyzer powered by artificial intelligence, were used to uncover possible biomarkers. Between the months of June 2018 and June 2019, 36 patients were enrolled. The overall response rate was 36.1%, and illness control was at a remarkable 97.2%. Median progression-free survival [95% CI, 8.6–16.8 months]. Median OS was not reached, and OS rate at 6 months was 97.0% (95% CI, 80.4%–99.6%). The grade above or equal to 3 treatment-related adverse events was hypertension (2.8%) and anemia (2.8%). In multivariate analysis of mutation of chromatin modifier gene, tumor mutational burden (≥ 2.1 mut/Mb), and somatic copy-number alteration (SCNA) level, the group with high SCNA (> 3 points; HR, 7.0; 95% CI, 1.3–37.9; P=0.02) had independently associated with poor PFS. In addition, tumors with a large percentage of an immune-excluded immunological phenotype had a statistically negative relationship with PFS (HR, 4.4; 95% CI, 1.2-16.2; P=0.018). For patients with advanced NPC who had previously failed platinum-based combination chemotherapy, adding nivolumab to gemcitabine demonstrated encouraging results with manageable side effects.