Fe K-edge X-ray absorption near edge spectroscopy (XANES) and extended X-ray absorption fine structure (EXAFS) have been performed on electrodes containing LiFePO4 to determine the local atomic and electronic structure and their stability with electrochemical cycling. A versatile electrochemical in situ cell has been constructed for long-term soft and hard X-ray experiments for the structural investigation on battery electrodes during the lithium-insertion/extraction processes. The device is used here for an X-ray absorption spectroscopic study of lithium insertion/extraction in a LiFePO4 electrode, where the electrode contained about 7.7mg of LiFePO4 on a 20μm thick Al-foil. Fe K-edge X-ray absorption near edge spectroscopy (XANES) and extended X-ray absorption fine structure (EXAFS) have been performed on this electrode to determine the local atomic and electronic structure and their stability with electrochemical cycling. The initial state (LiFePO4) showed iron to be in the Fe2+ state corresponding to the initial state (0.0mAh) of the cell, whereas in the delithiated state (FePO4) iron was found to be in the Fe3+ state corresponding to the final charged state (3mAh). XANES region of the XAS spectra revealed a high spin configuration for the two states (Fe (II), d6 and Fe (III), d5). The results confirm that the olivine structure of the LiFePO4 and FePO4 is retained by the electrodes in agreement with the XRD observations reported previously. These results confirm that LiFePO4 cathode material retains good structural short-range order leading to superior cycling capability.