The effect of temperature on the luminescence properties of LiMgPO4 doped with Eu3+ and Eu2+ are presented. Depending on the excitation wavelength, luminescence spectra consist of two distinct broad emission bands peaking at 380 nm and 490 nm related to 4f65d1 → 4f7 (8S7/2) luminescence of Eu2+ and to europium-trapped exciton, respectively, and/or several sharp lines between the 580 nm and 710 nm region, ascribed to the 5D0 → 7FJ (J = 0, 1, 2, 3 and 4) transitions in Eu3+. To explain all the features of the Eu2+ and Eu3+ luminescence we discussed the existence of two different Eu sites substituting for Li+, with short and long distance compensation. The evident effect of increasing the intensity of the Eu2+ luminescence with increasing temperature was observed. It was considered that the charge compensation mechanism for Eu3+ and Li+ as well as Eu2+ replacing Li+ in the LiMgPO4 is a long distance compensation that allows for the existence of some of the europium ions either as Eu3+ at low temperature or as Eu2+ at high temperature. We concluded that Eu2+ in the Li+ site with long distance compensation yields only 4f65d1 → 4f7 luminescence, whereas Eu2+ in the Li+ site with short distance compensation yields 4f65d1 → 4f7 luminescence and europium-trapped exciton emission.