A method and an X-ray system are disclosed for generating a phase contrast image of an examination object. In an embodiment, the distribution of an electron density in the examination object is determined by defining energy-dependent attenuation values for X-radiation with at least two different X-ray energy spectra, phase-shift values are obtained from the previously determined electron density distribution, and a phase contrast image is generated from the calculated phase-shift values.