Coherent X-ray diffraction imaging is a rapidly advancing form of microscopy: diffraction patterns, measured using the latest third-generation synchrotron radiation sources, can be inverted to obtain full three-dimensional images of the interior density within nanocrystals1, 2, 3. Diffraction from an ideal crystal lattice results in an identical copy of this continuous diffraction pattern at every Bragg peak. This symmetry is broken by the presence of strain fields, which arise from the epitaxial contact forces that are inevitable whenever nanocrystals are prepared on a substrate4. When strain is present, the diffraction copies at different Bragg peaks are no longer identical and contain additional information, appearing as broken local inversion symmetry about each Bragg point. Here we show that one such pattern can nevertheless be inverted to obtain a 'complex' crystal density, whose phase encodes a projection of the lattice deformation. A lead nanocrystal was crystallized in ultrahigh vacuum from a droplet on a silica substrate and equilibrated close to its melting point. A three-dimensional image of the density, obtained by inversion of the coherent X-ray diffraction, shows the expected facetted morphology, but in addition reveals a real-space phase that is consistent with the three-dimensional evolution of a deformation field arising from interfacial contact forces. Quantitative three-dimensional imaging of lattice strain on the nanometre scale will have profound consequences for our fundamental understanding of grain interactions and defects in crystalline materials4. Our method of measuring and inverting diffraction patterns from nanocrystals represents a vital step towards the ultimate goal of atomic resolution single-molecule imaging that is a prominent justification for development of X-ray free-electron lasers5, 6, 7.