The light-induced phase transition between the low-spin (LS) and high-spin (HS) states of some transition-metal ions has been extensively studied in the fields of chemistry and materials science. In a crystalline extended system, magnetically ordering the HS sites of such transition-metal ions by irradiation should lead to spontaneous magnetization. Previous examples of light-induced ordering have typically occurred by means of an intermetallic charge transfer mechanism, inducing a change of valence of the metal centres. Here, we describe the long-range magnetic ordering of the extended FeII(HS) sites in a metal–organic framework caused instead by a light-induced excited spin-state trapping effect. The Fe–Nb-based material behaves as a spin-crossover magnet, in which a strong superexchange interaction (magnetic coupling through non-magnetic elements) between photo-produced FeII(HS) and neighbouring NbIV atoms operates through CN bridges. The magnetic phase transition is observed at 20 K with a coercive field of 240 Oe.