X-ray absorption spectroscopy (XAS) as a local structural tool for the study of the electrochemical processes in battery materials is highlighted. Due to its elemental specificity and high penetration of the X-rays in the 4-35 keV range, XAS is particularly suited for this, allowing the study of battery materials using specifically developed in situ electrochemical cells. This energy is required to dislodge one core electron from transition metal or p-group atoms, which are commonly used as redox centers in positive and negative electrode materials. In such a simple picture, the ejected photoelectron is scattered by the surrounding atoms, producing characteristic traces in the X-ray absorption spectrum. Both positive and negative electrode materials (intercalation, alloy and conversion electrodes) can be studied. The chapter starts with an introduction of the context around battery studies, followed by a short explanation of the photoelectric effect at the basis of the X-ray absorption phenomenon and to specific features of XAS. A selection of XAS experiments conducted in the field of batteries will be then outlined, also emphasizing the effects due to nanoscale dimension of the material studied. Finally, a perspectives section will summarize the specific role that this spectroscopy has played in the battery community.