Respiratory motion is difficult to compensate for with conventional radiotherapy systems. An accurate tracking method for following the motion of the tumor is of considerable clinical relevance. We investigate methods to compensate for respiratory motion using robotic radiosurgery. In this system the therapeutic beam is moved by a robotic arm, and follows the moving target through a combination of infrared tracking and synchronized x-ray imaging. Infrared emitters are used to record the motion of the patient's skin surface. The position of internal gold fiducials is computed repeatedly during treatment, via x-ray image processing. We correlate the motion between external and internal markers. From this correlation model we infer the placement of the internal target during time intervals where no x-ray images are taken. Fifteen patients with lung tumors have recently been treated with a fully integrated system implementing this new method. The clinical trials confirm our hypothesis that internal motion and external motion are indeed correlated. In a preliminar study we have extended our work to tracking without implanted fiducials, based on algorithms for computing deformation motions and digitally reconstructed radiographs.