Résumé : Background: HER2-positive breast cancers usually contain large amounts of T-cell infiltrate. We hypothesised that trastuzumab resistance in HER2-positive breast cancer could be mediated by immune mechanisms. We assessed the safety and anti-tumour activity of pembrolizumab, a programmed cell death protein 1 (PD-1) inhibitor, added to trastuzumab in trastuzumab-resistant, advanced HER2-positive breast cancer. Methods: We did this single-arm, multicentre, phase 1b–2 trial in 11 centres based in five countries. Eligible participants were women aged 18 years or older, who had advanced, histologically confirmed, HER2-positive breast cancer; documented progression during previous trastuzumab-based therapy; an Eastern Cooperative Oncology Group performance status of 0 or 1; and a formalin-fixed, paraffin-embedded metastatic tumour biopsy for central assessment of programmed cell death 1 ligand 1 (PD-L1) status. In phase 1b, we enrolled patients with PD-L1-positive tumours in a 3 + 3 dose-escalation of intravenous pembrolizumab (2 mg/kg and 10 mg/kg, every 3 weeks) plus 6 mg/kg of intravenous trastuzumab. The primary endpoint of the phase 1b study was the incidence of dose-limiting toxicity and recommended phase 2 dose; however, a protocol amendment on Aug 28, 2015, stipulated a flat dose of pembrolizumab of 200 mg every 3 weeks in all Merck-sponsored trials. In phase 2, patients with PD-L1-positive and PD-L1-negative tumours were enrolled in parallel cohorts and received the flat dose of pembrolizumab plus standard trastuzumab. The primary endpoint of the phase 2 study was the proportion of PD-L1-positive patients achieving an objective response. This trial is registered in ClinicalTrials.gov, number NCT02129556, and with EudraCT, number 2013-004770-10, and is closed. Findings: Between Feb 2, 2015, and April 5, 2017, six patients were enrolled in phase 1b (n=3 received 2 mg/kg pembrolizumab, n=3 received 10 mg/kg pembrolizumab) and 52 patients in phase 2 (n=40 had PD-L1-positive tumours, n=12 had PD-L1-negative tumours). The data cutoff for this analysis was Aug 7, 2017. During phase 1b, there were no dose-limiting toxicities in the dose cohorts tested. Median follow-up for the phase 2 cohort was 13·6 months (IQR 11·6–18·4) for patients with PD-L1-positive tumours, and 12·2 months (7·9–12·2) for patients with PD-L1-negative tumours. Six (15%, 90% CI 7–29) of 40 PD-L1-positive patients achieved an objective response. There were no objective responders among the PD-L1-negative patients. The most common treatment-related adverse event of any grade was fatigue (12 [21%] of 58 patients). Grade 3–5 adverse events occurred in 29 (50%) of patients, treatment-related grade 3–5 adverse events occurred in 17 (29%), and serious adverse events occurred in 29 (50%) patients. The most commonly occurring serious adverse events were dyspnoea (n=3 [5%]), pneumonitis (n=3 [5%]), pericardial effusion (n=2 [3%]), and upper respiratory infection (n=2 [3%]). There was one treatment-related death due to Lambert-Eaton syndrome in a PD-L1-negative patient during phase 2. Interpretation: Pembrolizumab plus trastuzumab was safe and showed activity and durable clinical benefit in patients with PD-L1-positive, trastuzumab-resistant, advanced, HER2-positive breast cancer. Further studies in this breast cancer subtype should focus on a PD-L1-positive population and be done in less heavily pretreated patients. Funding: Merck, International Breast Cancer Study Group.