X-ray free-electron lasers (FELs), which amplify light emitted by a relativistic electron beam, are extending nonlinear optical tech-
niques to shorter wavelengths, adding element specificity by exciting and probing electronic transitions from core levels. These
techniques would benefit tremendously from having a stable FEL source, generating spectrally pure and wavelength-tunable pulses.
We show that such requirements can be met by operating the FEL in the so-called echo-enabled harmonic generation (EEHG) con-
figuration. Here, two external conventional lasers are used to precisely tailor the longitudinal phase space of the electron beam
before emission of X-rays. We demonstrate high-gain EEHG lasing producing stable, intense, nearly fully coherent pulses at wave-
lengths as short as 5.9 nm (~211 eV) at the FERMI FEL user facility. Low sensitivity to electron-beam imperfections and observa-
tion of stable, narrow-band, coherent emission down to 2.6 nm (~474 eV) make the technique a prime candidate for generating
laser-like pulses in the X-ray spectral region, opening the door to multidimensional coherent spectroscopies at short wavelengths.