Aims. The aim of the project is to characterise the two components of the brown dwarf system nearest to the Sun, WISE J104915.57−531906.1 (also called Luhman 16AB) at optical and near-infrared wavelengths. Methods. We obtained high signal-to-noise intermediate-resolution (R ∼ 6000−11 000) optical (600−1000 nm) and near-infrared (1000−2480 nm) spectra of each component of Luhman 16AB with the X-Shooter instrument on the Very Large Telescope. Results. We classify the primary and secondary of the Luhman 16 system as L6−L7.5 and T0 ± 1, respectively, in agreement with previous measurements published in the literature. We present measurements of the lithium pseudo-equivalent widths, which appear of similar strength in both components (8.2 ± 1.0 Å for the L and 8.4 ± 1.5 Å for the T component). The presence of lithium ( 7 Li) in both components implies masses lower than 0.06 M , while the comparison with models suggests lower limits of 0.04 M . The detection of lithium in the T component is the first of its kind. Similarly, we assess the strength of other alkali lines (e.g. pseudoequivalent widths of 6−7 Å for RbI and 4−7 Å for CsI) present in the optical and near-infrared regions and compare with estimates for L and T dwarfs. We also derive effective temperatures and luminosities of each component of the binary: −4.66 ± 0.08 dex and 1305K for the L dwarf and −4.68 ± 0.13 dex and 1320K for the T dwarf. According to our radial velocity determinations, the binary does not appear to belong to any of the well-known moving group. Our preliminary theoretical analysis of the optical and J-band spectra indicates that the L-and T-type spectra can be reproduced with a single temperature and gravity but different relative chemical abundances, which strongly affects the spectral energy distribution of L/T transition objects.