Three-dimensional magnetic resonance (3D MR) medical images may contain scanner- and patient-induced geometric distortion. For qualitative diagnosis, geometric errors of a few millimeters are often tolerated. However, quantitative applications such as image-guided neurosurgery and radiotherapy can require an accuracy of a millimeter or better. We have developed a method to accurately measure scanner-induced geometric distortion and to correct the MR images for this type of distortion. The method involves a number of steps. First, a specially designed phantom is scanned that contains a large number of reference structures, on positions with a manufacturing error of less than 0.05 mm. Next, the positions of the reference structures are automatically detected in the scanned images and a higher-order polynomial distortion-correction transformation is estimated. The transformation is then applied to correct the images for the detected distortion. The distortion-correction method is explained in detail in this paper. Furthermore, the validation of the method is briefly described; a more-detailed description is given in another submission to SPIE Medical Imaging 2001.