Some of the best-performing high-temperature magnets are Sm–Co-based alloys with a microstructure that comprises an $$\hbox {Sm}_2\hbox {Co}_{17}$$
Sm
2
Co
17
matrix and magnetically hard $$\hbox {SmCo}_5$$
SmCo
5
cell walls. This generates a dense domain-wall-pinning network that endows the material with remarkable magnetic hardness. A precise understanding of the coupling between magnetism and microstructure is essential for enhancing the performance of Sm–Co magnets, but experiments and theory have not yet converged to a unified model. Here, transmission electron microscopy, atom probe tomography, and nanometer-resolution off-axis electron holography have been combined with micromagnetic simulations to reveal that the magnetization state in Sm–Co magnets results from curling instabilities and domain-wall pinning effects at the intersections of phases with different magnetic hardness. Additionally, this study has found that topologically non-trivial magnetic domains separated by a complex network of domain walls play a key role in the magnetic state by acting as nucleation sites for magnetization reversal. These findings reveal previously hidden aspects of magnetism in Sm–Co magnets and, by identifying weak points in the microstructure, provide guidelines for improving these high-performance magnetic materials.