Purpose: High quality radiotherapy is challenging in cases where multiple targets with independent motion are simultaneously treated. A real-time tumor tracking system that can simultaneously account for the motion of two targets was developed and characterized. Methods: The multitarget tracking system was implemented on a magnetic resonance imaging (MRI)-linac and utilized multi-leaf collimator (MLC) tracking to adapt the radiation beam to phantom targets reproducing motion with prostate and lung motion traces. Multitarget tracking consisted of three stages: (a) pretreatment aperture segmentation where the treatment aperture was divided into segments corresponding to each target, (b) MR imaging where the positions of the two targets were localized, and (c) MLC tracking where an updated treatment aperture was calculated. Electronic portal images (EPID) acquired during irradiation were analyzed to characterize geometric uncertainty and tracking latency. Results: Multitarget MLC tracking effectively accounted for the motion of both targets during treatment. The root-mean-square error between the centers of the targets and the centers of the corresponding MLC leaves were reduced from 5.5 mm without tracking to 2.7 mm with tracking for lung motion traces and reduced from 4.2 to 1.4 mm for prostate motion traces. The end-to-end latency of tracking was measured to be 328 ± 44 ms. Conclusions: We have demonstrated the first experimental implementation of MLC tracking for multiple targets having independent motion. This technology takes advantage of the imaging capabilities of MRI-linacs and would allow treatment margins to be reduced in cases where multiple targets are simultaneously treated.