BERKELEY, Calif. (AP) — Cam Ward threw a 5-yard touchdown pass to Elijah Arroyo with 26 seconds left and No. 8 Miami roared back from a 25-point deficit in the second half to beat California 39-38 on Saturday night.

Ward led four straight touchdown drives to end the game and spoil what looked like the most monumental day in years for the Golden Bears (3-2, 0-2 ACC), who hosted ESPN’s “College GameDay” for the first time and were on the verge of their second win over a top 10 team in the past 21 seasons. Instead, Ward made sure the rare sellout crowd at Memorial Stadium went home unhappy after overcoming a 35-10 deficit in the third quarter. That gave the Hurricanes (6-0, 2-0) a second straight dramatic victory after needing a replay review to hold off Virginia Tech last week.

Ward threw an 18-yard TD pass to Isaiah Horton with 10:28 left to cut it to 38-25 and then scrambled in from 24 yards out to make it a six-point game with 4:04 to play. The Hurricanes forced a punt after being spared a potential targeting call on instant replay and Ward then hit Xavier Restrepo on a 77-yard pass on the first play on the ensuing drive to get Miami into the red zone. A personal foul backed up the Hurricanes but Ward converted a third-and-20 on a short pass to Joshisa Trader that went for 22 yards down to the 3.

Two plays later, Ward found Arroyo on a jump pass that gave Miami the lead. Ward finished 33 for 53 for 437 yards with two touchdown passes and a TD run, overcoming a pick-6.