BERKELEY, California — Arizona State coach Todd Graham could see the trouble coming long before California kicker Matt Anderson ended the Sun Devils' hopes of keeping their late-season momentum going.
With his defense unable to slow down the Golden Bears offense in the second half, Graham knew it was just a matter of time before things fell apart.
It happened quickly in one of the wildest fourth quarters in school history.
Mike Bercovici threw four touchdown passes and Zane Gonzalez set a school record with six field goals — four in the second half — but Arizona State gave up five touchdowns in the second half in a 48-46 loss to California on Saturday night.
"You can't play defense like that and have a chance to win," Graham said. "We absolutely knew exactly what they were doing and couldn't stop it. We tried everything humanly possible. It's pretty dang frustrating.
"If you score 46 points, you ought to win the game."
The Sun Devils (6-6, 4-5 Pac-12) were in position to do just that until a fourth quarter that featured five lead changes.
Even then, Arizona held a 46-45 lead with 2:35 remaining following Bercovici's 4-yard touchdown to backup tight end Raymond Epps — the first of Epps' career.
But quarterback Jared Goff engineered a final drive for the Golden Bears and Matt Anderson kicked a 26-yard field goal as time expired to cap the improbable comeback for Cal.
"It didn't look good at times but they just kept believing in each other and kept doing the right thing over and over," Bears coach Sonny Dykes said.
Jared Goff threw five touchdown passes and completed 30 of 51 passes for a school-record 542 yards in what may be his final game at Memorial Stadium. The Golden Bears' record-setting quarterback is projected as a first-round pick in the 2016 NFL draft should he forgo his senior year.
California (7-5, 4-5) trailed by 21 points midway through the second quarter but outscored Arizona State 38-19 over the final two quarters.
"It comes down to us defensively," Sun Devils cornerback Lloyd Carrington said. "For the most part, we did that. There were times we didn't do well and that costs us."
Goff shook off a rough start to lead Cal's comeback. He completed three passes for 44 yards and scrambled out of a potential sack on the game-winning drive.
Anderson, who earlier kicked a 39-yard field goal, nailed the game-winning kick after the Sun Devils called a timeout to try to ice him.
After Anderson's kick split the uprights, California's players raced out from the sidelines and mobbed the young kicker near midfield.
The Bears were on the verge of getting blown out before Goff led the comeback.
Arizona State moved the ball at will in the first half and caught a break when California's Kanawai Noa muffed a fair catch attempt near his own goal line late in the first quarter.
Three plays later Bercovici found wide receiver Devin Lucien on a crossing pattern for the first of three touchdowns by the Sun Devils' duo.
Bercovici and Lucien also connected on scores of 3 and 36 yards, and Zane Gonzalez added two field goals to push Arizona State's lead to 27-10 at the half.
Lucien finished with eight catches for 200 yards.
But the Sun Devils settled for field goals in the second half while the Bears scored touchdowns, an exchange that wound up costing Arizona State.
"It's not easy to get in the end zone but at the end of the day it's on me as quarterback to make sure we get six points," Bercovici said. "Obviously Zane and the special teams unit did an incredible job. We didn't get it done tonight."
Goff got the Bears going with a 52-yard touchdown to Bryce Treggs just before halftime. He later threw a 16-yard touchdown to Chad Hansen in the third quarter and a 9-yarder to Maurice Harris for a 9-yarder to help pull Cal within 33-31.
Goff added two more touchdown passes in the frantic fourth quarter.