The concept of temperature in nonequilibrium thermodynamics is an outstanding theoretical issue. We propose an energy repartition principle that leads to a spectral (mode-dependent) temperature in steady-state nonequilibrium systems. The general concepts are illustrated by analytic solutions of the classical Heisenberg spin chain connected to Langevin heat reservoirs with arbitrary temperature profiles. Gradients of external magnetic fields are shown to localize spin waves in a Wannier-Zeemann fashion, while magnon interactions renormalize the spectral temperature. Our generic results are applicable to other thermodynamic systems such as Newtonian liquids, elastic solids, and Josephson junctions.