Blockade of the programmed death 1 (PD-1) pathway has emerged as a novel therapy for cancer. Therefore, development of biomarkers for response prediction, such as PD-ligand 1 (PD-L1) expression by immunohistochemistry, may help to stratify patients. Solid tumors with CD8 T-cell rich tumor microenvironment have been implicated to be associated with increased PD-L1 expression. We hypothesized that gastric cancers associated with Epstein-Barr virus infection (EBV+) or microsatellite instability (MSI), both of which are known to harbor such tumor microenvironment, are associated with increased PD-L1 expression. Forty-four resected gastric cancers including 7 EBV+, 16 MSI, and 21 microsatellite stable cancers without EBV (EBV-/MSS) were studied for PD-L1 expression and T-cell subpopulations by immunohistochemistry. Positive PD-L1 expression (PD-L1+), defined as membranous staining in either tumor cells or tumor immune infiltrates, was seen in 32 (72%) gastric cancers. EBV+ or MSI cancers showed significantly higher rates of PD-L1+ compared with EBV-/MSS cancers (7/7, 100%; 14/16, 87%; 11/21, 52%; P=0.013). PD-L1+/EBV+ and PD-L1+/MSI cancers had significantly more CD8 T cells at tumor invasive front than PD-L1+/EBV-/MSS cancers (P<0.001). PD-L1+ was not associated with the depth of invasion or nodal metastasis (P=0.534, 0.288). Multivariate analysis showed PD-L1+ was not an independent predictor of disease-free survival while MSI was (P=0.548, 0.043). In summary, EBV+ or MSI gastric cancers are more likely to express PD-L1 and have increased CD8 T cells at tumor invasive front than EBV-/MSS cancers. Our results suggest EBV infection and MSI should be investigated for predicting response to PD-1 blockade.