The co-existence of ferromagnetism and superconductivity becomes possible through unconventional pairing in the superconducting state. Such materials are exceedingly rare in solid-state systems but are promising platforms to explore topological phases, such as Majorana bound states. Theoretical investigations date back to the late 1950s, but only a few systems have been experimentally identified as the potential host. Here, we show that atomically-thin niobium diselenide (NbSe2) intercalated with dilute cobalt atoms spontaneously displays ferromagnetism below the superconducting transition temperature (T_C). We elucidate the origin of this phase by constructing a magnetic tunnel junction that consists of cobalt and cobalt-doped niobium diselenide (Co-NbSe2) as the two ferromagnetic electrodes, with an ultra-thin boron nitride as the tunnelling barrier. At a temperature well below T_C, the tunnelling magnetoresistance shows a bistable state, suggesting a ferromagnetic order in Co-NbSe2. We propose a Ruderman–Kittel–Kasuya–Yosida exchange coupling mechanism based on spin-triplet superconducting order parameter to mediate such ferromagnetism. We further perform non-local lateral spin valve measurements to confirm the origin of the ferromagnetism. The Hanle precession signals show spin diffusion length up to micrometres below T_C, demonstrating an intrinsic spin-triplet nature in superconducting NbSe2. Our discovery of superconductivity-mediated ferromagnetism opens the door to the alternative design of ferromagnetic superconductors.