Ferromagnetic semiconductors, coupling charge transport and magnetism via electrical means, show great promise for spin-based logic devices. Despite decades of efforts to achieve such co-functionality, maintaining ferromagnetic order at room temperature remains elusive. Here, we address this long-standing challenge by implanting dilute Co atoms into few-layer black phosphorus through atomically-thin boron nitride diffusion barrier. Our Co-doped black phosphorus-based devices exhibit ferromagnetism up to room temperature while preserving its high mobility (~ $${1000{{{\rm{cm}}}}}^{2}{{{{\rm{V}}}}}^{-1}{{{{\rm{s}}}}}^{-1}$$ ) and semiconducting characteristics. By incorporating ferromagnetic Co-doped black phosphorus into magnetic tunnel junction devices, we demonstrate a large tunnelling magnetoresistance that extends up to room temperature. This study presents a new approach to engineering ferromagnetic ordering in otherwise nonmagnetic materials, thereby expanding the repertoire and applications of magnetic semiconductors envisioned thus far. Ferromagnetic semiconductors that have the critical properties of semiconductors and ferromagnetism at room temperature have so far proven elusive. Here, by doping black phosphorus with Cobalt, Fu, Qu, Hou, Chang and coauthors induce ferromagnetism that persists up to room temperature, all while maintaining black phosphorus’ semiconducting properties.