The immune checkpoint inhibitor ipilimumab is the standard-of-care treatment for patients with advanced melanoma. Pembrolizumab inhibits the programmed cell death 1 (PD-1) immune checkpoint and has antitumor activity in patients with advanced melanoma.In this randomized, controlled, phase 3 study, we assigned 834 patients with advanced melanoma in a 1:1:1 ratio to receive pembrolizumab (at a dose of 10 mg per kilogram of body weight) every 2 weeks or every 3 weeks or four doses of ipilimumab (at 3 mg per kilogram) every 3 weeks. Primary end points were progression-free and overall survival.The estimated 6-month progression-free-survival rates were 47.3% for pembrolizumab every 2 weeks, 46.4% for pembrolizumab every 3 weeks, and 26.5% for ipilimumab (hazard ratio for disease progression, 0.58; P<0.001 for both pembrolizumab regimens versus ipilimumab; 95% confidence intervals [CIs], 0.46 to 0.72 and 0.47 to 0.72, respectively). Estimated 12-month survival rates were 74.1%, 68.4%, and 58.2%, respectively (hazard ratio for death for pembrolizumab every 2 weeks, 0.63; 95% CI, 0.47 to 0.83; P=0.0005; hazard ratio for pembrolizumab every 3 weeks, 0.69; 95% CI, 0.52 to 0.90; P=0.0036). The response rate was improved with pembrolizumab administered every 2 weeks (33.7%) and every 3 weeks (32.9%), as compared with ipilimumab (11.9%) (P<0.001 for both comparisons). Responses were ongoing in 89.4%, 96.7%, and 87.9% of patients, respectively, after a median follow-up of 7.9 months. Efficacy was similar in the two pembrolizumab groups. Rates of treatment-related adverse events of grade 3 to 5 severity were lower in the pembrolizumab groups (13.3% and 10.1%) than in the ipilimumab group (19.9%).The anti-PD-1 antibody pembrolizumab prolonged progression-free survival and overall survival and had less high-grade toxicity than did ipilimumab in patients with advanced melanoma. (Funded by Merck Sharp & Dohme; KEYNOTE-006 ClinicalTrials.gov number, NCT01866319.).