Arizona State 38, USC 34

(Updated: CORRECTING: Arizona State’s rushing yards in Game Notebook.)

No. 24 Arizona State 38, No. 20 USC 34: Mike Bercovici threw for 510 yards and five touchdowns, including a 46-yard score to Jaelen Strong as time expired, as the visiting Sun Devils scored 21 points in the final four minutes to upset the Trojans.

Bercovici completed 27-of-45 passes and Strong made 10 catches for 202 yards and three scores for Arizona State (4-1, 2-1 Pac-12), which had 541 yards of total offense and posted its first win at USC since 1999. D.J. Foster rushed 10 times for 13 yards but caught a 21-yard TD pass with 3:53 left to cut the Sun Devils’ deficit to 27-25.

Cody Kessler was 28-of-45 for 273 yards and rushed for a score while Javorius Allen rushed 29 times for 143 yards and two TDs for USC (3-2, 2-1), which took an early lead on Nelson Agholor’s 53-yard punt return for a touchdown 5:14 into the first quarter. Allen, who added four catches for 86 yards, scored on a 53-yard run to put the Trojans ahead 34-25 with 3:02 remaining.

Bercovici connected with Cameron Smith for a 73-yard score on the Sun Devils’ next play from scrimmage to cut the deficit to 34-32. The Sun Devils forced a punt before Bercovici capped the comeback on the final drive with a 26-yard pass to Gary Chambers and the Hail Mary pass to Strong in the end zone.

Arizona State, which defeated the Trojans 62-41 last season in Tempe, led 15-7 after opening the second quarter with two TD passes from Bercovici to Strong. USC closed the half with 10 straight points as Allen scored on a 1-yard plunge and Andre Heidari booted a 35-yard field goal put the Trojans ahead 17-15 at the break.

GAME NOTEBOOK: Arizona State, which attempted two unsuccessful onside kicks in the final four minutes, burned its final second-half timeout with 2:25 left in the third quarter. … USC lost despite holding the Sun Devils to 31 rushing yards. … RB Justin Davis gained 67 yards on the ground and Agholor made nine catches for 85 yards for the Trojans, who rushed for 220 yards.