Combining high-contrast imaging with medium-resolution spectroscopy has been shown to significantly boost the direct detection of exoplanets. HARMONI, one of the first-light instruments to be mounted on ESOs ELT, will be equipped with a single-conjugated adaptive optics system to reach the diffraction limit of the ELT in H and K bands, a high-contrast module dedicated to exoplanet imaging, and a medium-resolution (up to R = 17 000) optical and near-infrared integral field spectrograph. Combined together, these systems will provide unprecedented contrast limits at separations between 50 and 400 mas. In this paper, we estimate the capabilities of the HARMONI high-contrast module for the direct detection of young giant exoplanets. We use an end-to-end model of the instrument to simulate observations based on realistic observing scenarios and conditions. We analyze these data with the so-called molecule mapping technique combined to a matched-filter approach, in order to disentangle the companions from the host star and tellurics, and increase the S/N of the planetary signal. We detect planets above 5-sigma at contrasts up to 16 mag and separations down to 75 mas in several spectral configurations of the instrument. We show that molecule mapping allows the detection of companions up to 2.5 mag fainter compared to state-of-the-art high-contrast imaging techniques based on angular differential imaging. We also demonstrate that the performance is not strongly affected by the spectral type of the host star, and that we reach close sensitivities for the best three quartiles of observing conditions at Armazones, which means that HARMONI could be used in near-critical observations during 60 to 70% of telescope time at the ELT. Finally, we simulate planets from population synthesis models to further explore the parameter space that HARMONI and its high-contrast module will soon open.