The invention relates to a method and a device for generating phase contrast X-ray images of an object (1). The device comprises an X-ray source (10) that may for example be realized by a spatially extended emitter (11) behind a grating (G0). A diffractive optical element (DOE), for example a phase grating (G1), generates an interference pattern (I) from the X-radiation that has passed the object (1), and a spectrally resolving X-ray detector (30) is used to measure this interference pattern behind the DOE. Using the information obtained for different wavelengths/energies of X-radiation, the phase shift induced by the object can be reconstructed.