Terahertz electromagnetic radiation is extremely useful for numerous applications such as imaging and spectroscopy. Therefore, it is highly desirable to have an efficient table-top emitter covering the 1-to-30-THz window whilst being driven by a low-cost, low-power femtosecond laser oscillator. So far, all solid-state emitters solely exploit physics related to the electron charge and deliver emission spectra with substantial gaps. Here, we take advantage of the electron spin to realize a conceptually new terahertz source which relies on tailored fundamental spintronic and photonic phenomena in magnetic metal multilayers: ultrafast photo-induced spin currents, the inverse spin-Hall effect and a broadband Fabry-Perot resonance. Guided by an analytical model, such spintronic route offers unique possibilities for systematic optimization. We find that a 5.8-nm-thick W/CoFeB/Pt trilayer generates ultrashort pulses fully covering the 1-to-30-THz range. Our novel source outperforms laser-oscillator-driven emitters such as ZnTe(110) crystals in terms of bandwidth, terahertz-field amplitude, flexibility, scalability and cost.