The metal centres in metalloenzymes and molecular catalysts are responsible for the rearrangement of atoms and electrons during complex chemical reactions, and they enable selective pathways of charge and spin transfer, bond breaking/making and the formation of new molecules. Mapping the electronic structural changes at the metal sites during the reactions gives a unique mechanistic insight that has been difficult to obtain to date. The development of X-ray free-electron lasers (XFELs) enables powerful new probes of electronic structure dynamics to advance our understanding of metalloenzymes. The ultrashort, intense and tunable XFEL pulses enable X-ray spectroscopic studies of metalloenzymes, molecular catalysts and chemical reactions, under functional conditions and in real time. In this Technical Review, we describe the current state of the art of X-ray spectroscopy studies at XFELs and highlight some new techniques currently under development. With more XFEL facilities starting operation and more in the planning or construction phase, new capabilities are expected, including high repetition rate, better XFEL pulse control and advanced instrumentation. For the first time, it will be possible to make real-time molecular movies of metalloenzymes and catalysts in solution, while chemical reactions are taking place.