© 2016 Elsevier Ltd Background Cancer of unknown primary ranks in the top ten cancer presentations and has an extremely poor prognosis. Identification of the primary tumour and development of a tailored site-specific therapy could improve the survival of these patients. We examined the feasability of using DNA methylation profiles to determine the occult original cancer in cases of cancer of unknown primary. Methods We established a classifier of cancer type based on the microarray DNA methylation signatures (EPICUP) in a training set of 2790 tumour samples of known origin representing 38 tumour types and including 85 metastases. To validate the classifier, we used an independent set of 7691 known tumour samples from the same tumour types that included 534 metastases. We applied the developed diagnostic test to predict the tumour type of 216 well-characterised cases of cancer of unknown primary. We validated the accuracy of the predictions from the EPICUP assay using autopsy examination, follow-up for subsequent clinical detection of the primary sites months after the initial presentation, light microscopy, and comprehensive immunohistochemistry profiling. Findings The tumour type classifier based on the DNA methylation profiles showed a 99·6% specificity (95% CI 99·5–99·7), 97·7% sensitivity (96·1–99·2), 88·6% positive predictive value (85·8–91·3), and 99·9% negative predictive value (99·9–100·0) in the validation set of 7691 tumours. DNA methylation profiling predicted a primary cancer of origin in 188 (87%) of 216 patients with cancer with unknown primary. Patients with EPICUP diagnoses who received a tumour type-specific therapy showed improved overall survival compared with that in patients who received empiric therapy (hazard ratio [HR] 3·24, p=0·0051 [95% CI 1·42–7·38]; log-rank p=0·0029). Interpretation We show that the development of a DNA methylation based assay can significantly improve diagnoses of cancer of unknown primary and guide more precise therapies associated with better outcomes. Epigenetic profiling could be a useful approach to unmask the original primary tumour site of cancer of unknown primary cases and a step towards the improvement of the clinical management of these patients. Funding European Research Council (ERC), Cellex Foundation, the Institute of Health Carlos III (ISCIII), Cancer Australia, Victorian Cancer Agency, Samuel Waxman Cancer Research Foundation, the Health and Science Departments of the Generalitat de Catalunya, and Ferrer.