The second near-infrared wavelength window (NIR-II, 1,000-1,700 nm) enables fluorescence imaging of tissue with enhanced contrast at depths of millimetres and at micrometre-scale resolution. However, the lack of clinically viable NIR-II equipment has hindered the clinical translation of NIR-II imaging. Here, we describe an optical-imaging instrument that integrates a visible multispectral imaging system with the detection of NIR-II and NIR-I (700-900 nm in wavelength) fluorescence (by using the dye indocyanine green) for aiding the fluorescence-guided surgical resection of primary and metastatic liver tumours in 23 patients. We found that, compared with NIR-I imaging, intraoperative NIR-II imaging provided a higher tumour-detection sensitivity (100% versus 90.6%; with 95% confidence intervals of 89.1%-100% and 75.0%-98.0%, respectively), a higher tumour-to-normal-liver-tissue signal ratio (5.33 versus 1.45) and an enhanced tumour-detection rate (56.41% versus 46.15%). We infer that combining the NIR-I/II spectral windows and suitable fluorescence probes might improve image-guided surgery in the clinic.