The recent development of integrated computed tomography (CT)/linear accelerator (LINAC) combinations, where the CT scanner and the LINAC use the same patient couch, and of kilovoltage cone-beam CT systems attached to the LINAC gantry, means that suitable hardware is now available for CT-guided localization of the prostate. Clinical implementation is, however, currently impeded by the lack of robust and accurate software tools to compare the position of the prostate in the CT images used for the treatment plan with its position in the daily CT images. Manual registration of the planning CT images with the daily CT images can be slow and can introduce significant inter-user variations. We have developed an automatic registration technique that is not adversely influenced by changes in prostate shape, size or orientation, presence of rectal gas, or bladder filling. The cost function used in the registration is the mean absolute difference in CT numbers voxel-by-voxel between the daily CT image and the planning CT image for a volume extracted from the planning CT images using the original physician-drawn gross tumor volume contours. To enhance soft tissue contrast in the prostate region and to reduce the impact of rectal gas calcifications and bone on the registration, voxels with CT numbers that represent gas or bone are filtered out from the calculation. The results of the automatic registration agreed with the mean results of seven human observers, with standard deviations of 0.5 mm, 0.5 mm, and 1.0 mm in the left/right (RL), anterior/posterior (AP), and superior/inferior (SI) directions, respectively, for a patient that was relatively easy to localize. Agreement (one standard deviation) for a patient that was difficult to localize was 0.6 mm, 1.4 mm, and 1.9 mm in the RL, AP, and SI directions, respectively. These results are better than the interuser uncertainties reported for a manual alignment technique and are close to the reported intrauser uncertainties. The results are independent of the shape of contours in the original treatment plan, reducing the impact of interobserver variations in contouring the prostate. The algorithm is fast and reliable, allowing the entire CT localization process to take place in 5-9 minutes. In 120 CT image sets from seven patients, the failure rate was found to be less than 1%. The use of this algorithm will facilitate the clinical implementation of CT-guided localization of the prostate.