The temporal structure and high brilliance of the X-ray beams produced by third-generation synchrotrons open up new possibilities in time-dependent diffraction and spectroscopy, where timescales down to the sub-nanosecond regime can now be accessed. These beam properties are such that one can envisage the development of the X-ray equivalent of optical components, such as photon delay lines and resonators, that have proved indispensable in a wide range of experiments-for example, pump-probe and multiple-interaction experiments-and (through shaping the temporal structure and repetition rate of the beams) time-dependent measurements in crystallography, physics, biology and chemistry. Optical resonators, such as those used in lasers, are available at wavelengths from the visible to soft X-rays. Equivalent components for hard X-rays have been discussed for more than thirty years, but have yet to be realized. Here we report the storage of hard X-ray photons (energy 15.817 keV) in a crystal resonator formed by two plates of crystalline silicon. The photons are stored for as many as 14 back-and-forth cycles within the resonator, each cycle separated by one nanosecond.