Background Nivolumab, a fully human IgG4 PD-1 immune checkpoint inhibitor antibody, can result in durable responses in patients with melanoma who have progressed after ipilimumab and BRAF inhibitors. We assessed the efficacy and safety of nivolumab compared with investigator's choice of chemotherapy (ICC) as a second-line or later-line treatment in patients with advanced melanoma. Methods In this randomised, controlled, open-label, phase 3 trial, we recruited patients at 90 sites in 14 countries. Eligible patients were 18 years or older, had unresectable or metastatic melanoma, and progressed after ipilimumab, or ipilimumab and a BRAF inhibitor if they were BRAFV 600 mutation-positive. Participating investigators randomly assigned (with an interactive voice response system) patients 2:1 to receive an intravenous infusion of nivolumab 3 mg/kg every 2 weeks or ICC (dacarbazine 1000 mg/m2 every 3 weeks or paclitaxel 175 mg/m2 combined with carboplatin area under the curve 6 every 3 weeks) until progression or unacceptable toxic effects. We stratified randomisation by BRAF mutation status, tumour expression of PD-L1, and previous best overall response to ipilimumab. We used permuted blocks (block size of six) within each stratum. Primary endpoints were the proportion of patients who had an objective response and overall survival. Treatment was given open-label, but those doing tumour assessments were masked to treatment assignment. We assessed objective responses per-protocol after 120 patients had been treated with nivolumab and had a minimum follow-up of 24 weeks, and safety in all patients who had had at least one dose of treatment. The trial is closed and this is the first interim analysis, reporting the objective response primary endpoint. This study is registered with ClinicalTrials.gov, number NCT01721746. Findings Between Dec 21, 2012, and Jan 10, 2014, we screened 631 patients, randomly allocating 272 patients to nivolumab and 133 to ICC. Confirmed objective responses were reported in 38 (31·7%, 95% CI 23·5–40·8) of the first 120 patients in the nivolumab group versus five (10·6%, 3·5–23·1) of 47 patients in the ICC group. Grade 3–4 adverse events related to nivolumab included increased lipase (three [1%] of 268 patients), increased alanine aminotransferase, anaemia, and fatigue (two [1%] each); for ICC, these included neutropenia (14 [14%] of 102), thrombocytopenia (six [6%]), and anaemia (five [5%]). We noted grade 3–4 drug-related serious adverse events in 12 (5%) nivolumab-treated patients and nine (9%) patients in the ICC group. No treatment-related deaths occurred. Interpretation Nivolumab led to a greater proportion of patients achieving an objective response and fewer toxic effects than with alternative available chemotherapy regimens for patients with advanced melanoma that has progressed after ipilimumab or ipilimumab and a BRAF inhibitor. Nivolumab represents a new treatment option with clinically meaningful durable objective responses in a population of high unmet need. Funding Bristol-Myers Squibb.