A computer algorithm for the three-dimensional (3D) alignment of PET images is described. To align two images, the algorithm calculates the ratio of one image to the other on a voxel-by-voxel basis and then iteratively moves the images relative to one another to minimize the variance of this ratio across voxels. Since the method relies on anatomic information in the images rather than on external fiducial markers, it can be applied retrospectively. Validation studies using a 3D brain phantom show that the algorithm aligns images acquired at a wide variety of positions with maximum positional errors that are usually less than the width of a voxel (1.745 mm). Simulated cortical activation sites do not interfere with alignment. Global errors in quantitation from realignment are less than 2%. Regional errors due to partial volume effects are largest when the gantry is rotated by large angles or when the bed is translated axially by one-half the interplane distance. To minimize such partial volume effects, the algorithm can be used prospectively, during acquisition, to reposition the scanner gantry and bed to match an earlier study. Computation requires 3-6 min on a Sun SPARCstation 2.