Purpose: To develop and evaluate a template matching algorithm for direct detection of a lung tumor trajectory in the raw projections acquired from a cone beam CT. Method and Materials: A planning respiration‐correlated CT (pRCCT) was used to construct digitally‐reconstructed radiographic (DRR) templates for registration with raw projection data of a free‐breathing cone beam CT (FB‐CBCT). The pRCCT and FB‐CBCT were first registered to obtain the approximate mean 3D position of the tumor. This position was applied as a shift to the planning isocenter in the pRCCT. Next, 72 DRRs were generated at 5 degree angular increments around this shifted position, for each phase in the pRCCT. The appropriate phase DRR template for registration was selected using the measured phase of the FB‐CBCT projection. This phase was measured by tracking the diaphragm apex position in the projections. Two template matching algorithms were compared: normalized cross correlation and a block normalized cross correlation. A dynamic phantom was induced to move reproducibly 2cm during planning and 3cm during online CBCT imaging. The phantom was imaged at isocenter and with a 1cm translational shift from isocenter. Results: The tumor excursion measured with the normalized cross correlation method was 28.7 mm, and 28.5 mm with the block normalized cross correlation. The error in detecting the daily standard deviation of tumor position was 0.1mm for both methods. The mean absolute difference in detected tumor position was 1.07 mm, with a 95% confidence value of 2.43 mm. Block normalized cross correlation reduced the maximum error in tumor position detection slightly, in relation to normalized cross correlation. Conclusion: Direct detection of the tumor position from cone beam CT projections is feasible with template matching, provided that appropriate and accurate templates are used. Conflict of Interest: Supported in part by NIH R01 CA116249 and Elekta, Inc.