Abstract We present a first-principles approach for the computation of the magnetic Gibbs free energy of materials using magnetically constrained supercell calculations. Our approach is based on an adiabatic approximation of slowly varying local moment orientations, the so-called finite-temperature disordered local moment picture. It describes magnetic phase transitions and how electronic and/or magnetostructural mechanisms generate a discontinuous (first-order) character.