X-ray absorption spectroscopy was used to characterize the local structural environment of the vanadium ions in Mg doped Li3V(2-2x/3)Mgx(PO4)3; x = 0.15, 0.30, 0.45, (LVP) in a functioning battery. For all three compositions the x-ray absorption near-edge structure spectra show evidence for only two spectroscopically distinguishable species when the potential is cycled between 3 and 4.5 V. These are attributed to octahedral V3+ and V4+ in LVP. If the potential is increased above 4.5 V a third species that is consistent with V5+ in a distorted, possibly tetrahedral environment is formed. For x = 0.30 and x = 0.45 this species disappears when the potential is lowered. In contrast, for x = 0.15 a fourth species is formed on reduction. This new species is consistent with V4+ in a distorted tetrahedral environment and may explain the loss of capacity in the 15% sample during cycling. Although the potential shows discrete plateaus, consistent with formation of mixed-valence species, these are not seen in the x-ray absorption. Rather, we see apparent deviations from Faraday's law that are consistent with a lag in oxidation of the bulk vanadium.