An algorithm was developed to estimate the 3D lung tumor position using the projection data forming a cone beam CT sinogram and a template registration method. A pre-existing respiration-correlated CT image was used to generate templates of the target, which were then registered to the individual cone beam CT projections, and estimates of the target position were made for each projection. The registration search region was constrained based on knowledge of the mean tumor position during the cone beam CT scan acquisition. Several template registration algorithms were compared, including correlation coefficient and robust methods such as block correlation, robust correlation coefficient and robust gradient correlation. Robust registration metrics were found to be less sensitive to occlusions such as overlying tissue and the treatment couch. The mean accuracy of the position estimation was 1.4 mm in phantom with a robust registration algorithm. In two research subjects with peripheral tumors, the mean position and mean target excursion were estimated to within 2.0 mm compared to the results obtained with a '4D' registration of 4D image volumes.