Context. Hydrides of the most abundant heavier elements are fundamental molecules in cosmic chemistry. Some of them trace gas irradiated by UV or X-rays. Aims. We explore the abundances of major hydrides in W3 IRS5, a prototypical region of high-mass star formation. Methods. W3 IRS5 was observed by HIFI on the Herschel Space Observatory with deep integration (2500 s) in 8 spectral regions. Results. The target lines including CH, NH, H3O+, and the new molecules SH+, H2O+, and OH+ are detected. The H2O+ and OH+ J = 1–0 lines are found mostly in absorption, but also appear to exhibit weak emission (P-Cyg-like). Emission requires high density, thus originates most likely near the protostar. This is corroborated by the absence of line shifts ...