A method of correcting motional artifacts in diffusion-weighted images is described. Motion causes changes in the phase of the k-space NMR signal and thereby introduces positional shifts (or ghosts) in the spatial domain. By correcting the phase of the NMR signal before Fourier transformation, the image sharpness is greatly enhanced. The new method measures the phases of the NMR signal once and stores this phase information in a phase map. Subsequent images with motional artifacts are corrected during postprocessing using this reference phase map.