The validity of the emission-line luminosity versus ionized gas velocity dispersion (L–σ) correlation for H II galaxies (HIIGx) and its potential as an accurate distance estimator are assessed. For a sample of 128 local (0.02 ≲ z ≲ 0.2) compact HIIGx with high equivalent widths of their Balmer emission lines, we obtained the ionized gas velocity dispersion from high signal-to-noise ratio (S/N) high-dispersion spectroscopy (Subaru High Dispersion Spectrograph (HDS) and European Southern Observatory (ESO) Very Large Telescope Ultraviolet and Visual Echelle Spectrograph (VLT–UVES)) and integrated Hβ fluxes from low-dispersion wide aperture spectrophotometry. We find that the L(Hβ)–σ relation is strong and stable against restrictions in the sample (mostly based on the emission-line profiles). The ‘Gaussianity’ of the profile is important for reducing the root-mean-square (rms) uncertainty of the distance indicator, but at the expense of substantially reducing the sample. By fitting other physical parameters into the correlation, we are able to decrease the scatter significantly without reducing the sample. The size of the star-forming region is an important second parameter, while adding the emission-line equivalent width or the continuum colour and metallicity produces the solution with the smallest rms scatter=δlog L(Hβ) = 0.233. The derived coefficients in the best L(Hβ)–σ relation are very close to what is expected from virialized ionizing clusters, while the derived sum of the stellar and ionized gas masses is similar to the dynamical mass estimated using the Hubble Space Telescope (HST) corrected Petrosian radius. These results are compatible with gravity being the main mechanism causing the broadening of the emission lines in these very young and massive clusters. The derived masses range from about 2 × 106 M⊙ to 109 M⊙ and their ‘corrected’ Petrosian radius ranges from a few tens to a few hundred pc.