Background Patients with incomplete surgical resection of medulloblastoma are controversially regarded as having a marker of high-risk disease, which leads to patients undergoing aggressive surgical resections, so-called second-look surgeries, and intensified chemoradiotherapy. All previous studies assessing the clinical importance of extent of resection have not accounted for molecular subgroup. We analysed the prognostic value of extent of resection in a subgroup-specific manner. Methods We retrospectively identified patients who had a histological diagnosis of medulloblastoma and complete data about extent of resection and survival from centres participating in the Medulloblastoma Advanced Genomics International Consortium. We collected from resections done between April, 1997, and February, 2013, at 35 international institutions. We established medulloblastoma subgroup affiliation by gene expression profiling on frozen or formalin-fixed paraffin-embedded tissues. We classified extent of resection on the basis of postoperative imaging as gross total resection (no residual tumour), near-total resection (<1·5 cm2 tumour remaining), or sub-total resection (≥1·5 cm2 tumour remaining). We did multivariable analyses of overall survival and progression-free survival using the variables molecular subgroup (WNT, SHH, group 4, and group 3), age (<3 vs ≥3 years old), metastatic status (metastases vs no metastases), geographical location of therapy (North America/Australia vs rest of the world), receipt of chemotherapy (yes vs no) and receipt of craniospinal irradiation (<30 Gy or >30 Gy vs no craniospinal irradiation). The primary analysis outcome was the effect of extent of resection by molecular subgroup and the effects of other clinical variables on overall and progression-free survival. Findings We included 787 patients with medulloblastoma (86 with WNT tumours, 242 with SHH tumours, 163 with group 3 tumours, and 296 with group 4 tumours) in our multivariable Cox models of progression-free and overall survival. We found that the prognostic benefit of increased extent of resection for patients with medulloblastoma is attenuated after molecular subgroup affiliation is taken into account. We identified a progression-free survival benefit for gross total resection over sub-total resection (hazard ratio [HR] 1·45, 95% CI 1·07–1·96, p=0·16) but no overall survival benefit (HR 1·23, 0·87–1·72, p=0·24). We saw no progression-free survival or overall survival benefit for gross total resection compared with near-total resection (HR 1·05, 0·71–1·53, p=0·8158 for progression-free survival and HR 1·14, 0·75–1·72, p=0·55 for overall survival). No significant survival benefit existed for greater extent of resection for patients with WNT, SHH, or group 3 tumours (HR 1·03, 0·67–1·58, p=0·89 for sub-total resection vs gross total resection). For patients with group 4 tumours, gross total resection conferred a benefit to progression-free survival compared with sub-total resection (HR 1·97, 1·22–3·17, p=0·0056), especially for those with metastatic disease (HR 2·22, 1·00–4·93, p=0·050). However, gross total resection had no effect on overall survival compared with sub-total resection in patients with group 4 tumours (HR 1·67, 0·93–2·99, p=0·084). Interpretation The prognostic benefit of increased extent of resection for patients with medulloblastoma is attenuated after molecular subgroup affiliation is taken into account. Although maximum safe surgical resection should remain the standard of care, surgical removal of small residual portions of medulloblastoma is not recommended when the likelihood of neurological morbidity is high because there is no definitive benefit to gross total resection compared with near-total resection. Funding Canadian Cancer Society Research Institute, Terry Fox Research Institute, Canadian Institutes of Health Research, National Institutes of Health, Pediatric Brain Tumor Foundation, and the Garron Family Chair in Childhood Cancer Research.