High-resolution optical spectra of the high-mass X-ray binary 4U 1907+09 covering the wavelength range 4680-10400 A indicate that the X-ray pulsar's massive companion is an O8/O9 supergiant with a dense stellar wind. The interstellar atomic lines of Na I and K I of this strongly reddened source (E(B-V) = 3.45 mag) are used to set a lower limit to its distance: d approximate to 5 kpc, excluding the possibility that the massive companion is a Be star. We re-evaluate the system parameters; the new spectral classification of 4U 1907+ 09's O supergiant companion is discussed in the context of its similarity in X-ray and orbital properties to Wray 15-977/GX 301-2. The Ha line shows variability similar to what is observed in other wind-fed systems. A remarkable feature is the strong He II 4686 A emission line, which possibly originates in the accretion flow towards the X-ray pulsar.