We present Very Large Telescope (VLT) UVES echelle spectrophotometry of the Orion nebula in the 3100–10 400 Å range. We have measured the intensity of 555 emission lines, many of them corresponding to permitted lines of different heavy-element ions. This is the largest set of spectral emission lines ever obtained for a Galactic or extragalactic H ii region. We have derived He+, C2+, O+, O2+ and Ne2+ abundances from pure recombination lines. This is the first time that O+ and Ne2+ abundances have been obtained from these kinds of lines in the nebula. We have also derived abundances from collisionally excited lines for a large number of ions of different elements. In all cases, ionic abundances obtained from recombination lines are larger than those derived from collisionally excited lines. We have obtained remarkably consistent independent estimations of the temperature fluctuation parameter, t2, from different methods, which are also similar to other estimates from the literature. This result strongly suggests that moderate temperature fluctuations (t2 between 0.02 and 0.03) are present in the Orion nebula. We have compared the chemical composition of the nebula with those of the Sun and other representative objects. The heavy-element abundances in the Orion nebula are only slightly higher than the solar ones, a difference that can be explained by the chemical evolution of the solar neighbourhood.