Background: Infected necrotising pancreatitis is a potentially lethal disease and an indication for invasive intervention. The surgical step-up approach is the standard treatment. A promising alternative is the endoscopic step-up approach. We compared both approaches to see whether the endoscopic step-up approach was superior to the surgical step-up approach in terms of clinical and economic outcomes. Methods: In this multicentre, randomised, superiority trial, we recruited adult patients with infected necrotising pancreatitis and an indication for invasive intervention from 19 hospitals in the Netherlands. Patients were randomly assigned to either the endoscopic or the surgical step-up approach. The endoscopic approach consisted of endoscopic ultrasound-guided transluminal drainage followed, if necessary, by endoscopic necrosectomy. The surgical approach consisted of percutaneous catheter drainage followed, if necessary, by video-assisted retroperitoneal debridement. The primary endpoint was a composite of major complications or death during 6-month follow-up. Analyses were by intention to treat. This trial is registered with the ISRCTN registry, number ISRCTN09186711. Findings: Between Sept 20, 2011, and Jan 29, 2015, we screened 418 patients with pancreatic or extrapancreatic necrosis, of which 98 patients were enrolled and randomly assigned to the endoscopic step-up approach (n=51) or the surgical step-up approach (n=47). The primary endpoint occurred in 22 (43%) of 51 patients in the endoscopy group and in 21 (45%) of 47 patients in the surgery group (risk ratio [RR] 0·97, 95% CI 0·62-1·51; p=0·88). Mortality did not differ between groups (nine [18%] patients in the endoscopy group vs six [13%] patients in the surgery group; RR 1·38, 95% CI 0·53-3·59, p=0·50), nor did any of the major complications included in the primary endpoint. Interpretation: In patients with infected necrotising pancreatitis, the endoscopic step-up approach was not superior to the surgical step-up approach in reducing major complications or death. The rate of pancreatic fistulas and length of hospital stay were lower in the endoscopy group. The outcome of this trial will probably result in a shift to the endoscopic step-up approach as treatment preference. Funding: The Dutch Digestive Disease Foundation, Fonds NutsOhra, and the Netherlands Organization for Health Research and Development.