We present here a first principles study of the structural, electronic, magnetic, and hyperfine properties of magnesium ferrite, MgFe2O4 (spinel structure). The study was carried out within the framework of Functional Density Theory (DFT) using the full potential linearized augmented plane waves method (FPLAPW) using both the Generalized Gradient (GGA) and the GGA+U approximations for the exchange and correlation potential. To discuss the magnetic ordering and the lowest energy structure of the system we consider different distributions of Mg and Fe ions in both cationic sites of the spinel structure, as well as different spin configurations. Our calculations predict that the equilibrium structure corresponds to an inverted antiferromagnetic configuration, in which the magnetic moments of the Fe atoms located at sites A are ferromagnetically ordered among themselves and antiferromagnetically with respect to the Fe located at the sublattice of sites B. Our GGA calculations underestimate the energy band-gap of the system, while GGA+U predict a band-gap of 2.3 eV, in excellent agreement with the reported values. The results for the hyperfine properties at the Fe sites (isomer shift, quadrupole splitting and hyperfine field) are in excellent agreement with the Mössbauer spectroscopy results reported in the literature, giving support to the equilibrium structure predicted by FP-LAPW.