Background. e 5-year survival rate of patients with metastatic gastric cancer (GC) is only 5%. However, trials have demonstrated promising antitumor activity for targeted therapies/immunotherapies among chemorefractory metastatic GC patients. Pembrolizumab has shown particular efficacy among patients with programmed death ligand-1 (PD-L1) expression and high microsatellite instability (MSI-H). e aim of this study was to assess the effectiveness and cost-effectiveness of biomarker-guided second-line GC treatment. Methods. We constructed a Markov decision-analytic model using clinical trial data. Our model compared pembrolizumab monotherapy and ramucirumab/paclitaxel combination therapy for all patients and pembrolizumab for patients based on MSI status or PD-L1 expression. Paclitaxel monotherapy and best supportive care for all patients were additional comparators. Costs of drugs, treatment administration, follow-up, and management of adverse events were estimated from a US payer perspective. e primary outcomes were quality-adjusted life years (QALYs) and incremental cost-effectiveness ratios (ICERs) with a willingness-to-pay threshold of $100,000/QALY over 60 months. Secondary outcomes were unadjusted life years (survival) and costs. Deterministic and probabilistic sensitivity analyses were performed to evaluate model uncertainty.Results. e most effective strategy was pembrolizumab for MSI-H patients and ramucirumab/paclitaxel for all other patients, adding 3.8 months or 2.0 quality-adjusted months compared to paclitaxel. However, this strategy resulted in a prohibitively high ICER of $1,074,620/QALY. e only cost-effective strategy was paclitaxel monotherapy for all patients, with an ICER of $53,705/ QALY. Conclusion. Biomarker-based treatments with targeted therapies/immunotherapies for second-line metastatic GC patients substantially improve unadjusted and quality-adjusted survival but are not cost-effective at current drug prices.