We present results of deep echelle spectrophotometry of the brightest knot of the Herbig–Haro object HH 202 in the Orion Nebula – HH 202-S – using the Ultraviolet Visual Echelle Spectrograph in the spectral range from 3100 to 10 400 Å. The high spectral resolution of the observations has permitted to separate the component associated with the ambient gas from that associated with the gas flow. We derive electron densities and temperatures from different diagnostics for both components, as well as the chemical abundances of several ions and elements from collisionally excited lines, including the first determinations of Ca+ and Cr+ abundances in the Orion Nebula. We also calculate the He+, C2+, O+ and O2+ abundances from recombination lines. The difference between the O2+ abundances determined from collisionally excited and recombination lines – the so-called abundance discrepancy factor – is 0.35 and 0.11 dex for the shock and nebular components, respectively. Assuming that the abundance discrepancy is produced by spatial variations in the electron temperature, we derive values of the temperature fluctuation parameter, t2, of 0.050 and 0.016 for the shock and nebular components, respectively. Interestingly, we obtain almost coincident t2 values for both components from the analysis of the intensity ratios of He i lines. We find significant departures from case B predictions in the Balmer and Paschen flux ratios of lines of high principal quantum number n. We analyse the ionization structure of HH 202-S, finding enough evidence to conclude that the flow of HH 202-S has compressed the ambient gas inside the nebula trapping the ionization front. We measure a strong increase of the total abundances of nickel and iron in the shock component, the abundance pattern and the results of photoionization models for both components are consistent with the partial destruction of dust after the passage of the shock wave in HH 202-S.