Shawn Moffitt kicked a 23-yard field goal as time expired after Rannell Hall got behind the Temple defense for a 64-yard reception, and No. 15 UCF survived a scare with a 39-36 victory Saturday.
UCF's last possession started at its own 19, with no timeouts. Overtime seemed likely until Blake Bortles found Hall deep to get to the Temple 6.
Bortles managed to get the ball spiked with 2 seconds left and Moffitt booted through the game winner to keep UCF (8-1, 5-0) in control of the American Athletic Conference race.
Freshman P.J. Walker was spectacular for Temple (1-0, 0-6), with a season-high 382 yards passing, four TD passes and a touchdown run.
Temple drops to 2-78 all-time against the Top 25 opponents.