The application of a 3.5 GPa pressure on Fe in a H 2 environment leads to the formation of iron hydride FeH. Using a combination of high pressure x-ray absorption spectroscopy (XAS) and x-ray magnetic circular dichroism (XMCD) at the Fe K edge, we have investigated the modification of electronic and magnetic properties induced (i) by the transition from bcc-Fe to dhcp (double hexagonal)-FeH under pressure and (ii) by the compression of FeH up to 28 GPa. XAS and XMCD spectra under pressure have been computed in bcc-Fe and dhcp-FeH within a monoelectronic framework. Our approach is based on a semirelativistic density-functional theory (DFT) calculation of the electron density in the presence of a core hole using plane waves and pseudopotentials. Our method has been successful to reproduce the experimental spectra and to interpret the magnetic and electronic structure of FeH. In addition, we have identified a transition around 28 GPa, which is a purely magnetic transition from a ferromagnetic state to a paramagnetic state.