Hundley accounted for 424 yards of offense to overcome his own fumble and interception as the Bruins (5-2, 2-2 Pac-12) won at Memorial Stadium for the first time since 1998.
It wasn't easy with the Bruins not taking the lead for good until Ka'imi Fairbairn kicked his third field goal, a 26-yarder with 3:40 remaining that provided the go-ahead score and helped UCLA get back on the winning track after losses to Utah and Oregon.
Goff threw for 303 yards and two touchdowns for the Golden Bears (4-3, 2-3), who have lost back-to-back home games after an impressive 4-1 start to the season.
There was a scary moment late in the game when Cal's Trevor Davis had to be taken off the field on a stretcher after being injured on a kickoff return. Davis was down on the turf for several minutes as teammates watched anxiously. He was able to move his legs and talk, and gave a thumb's up to the crowd. There was no immediate word on the extent of the injury.
UCLA moved the ball with ease for most of the game, punting just three times on 15 drives. But they committed three turnovers that turned into short touchdown drives for Cal, which proved to be a big factor in the game.
The most costly came midway through the fourth quarter when the Bruins had the ball in Cal territory looking to add to a 5-point lead. But Hundley threw behind Jordan Payton and Cameron Walker cut in front for an interception that he returned to the UCLA 32.
That set up Goff's 23-yard touchdown pass down the right sideline to Kenny Lawler that gave the Bears a 34-33 lead with less than 7 minutes to play.
But Hundley responded by leading the field goal drive and then got the big play from his defense to win it.
Cal stopped Hundley on a fourth-and-1 sneak just across midfield on the opening drive of the third quarter. Lasco scored on his second short run three plays later to cut UCLA's lead to 24-21.
The Bruins were then held to a field goal following Mossi Johnson's 67-yard kickoff return and the Bears managed to take the lead late in the third when Davis made a leaping grab while being interfered with by Jaleel Wadood for a 24-yard score.
UCLA answered on Hundley's 15-yard run in the closing seconds of the third to take a 33-28 lead heading into the fourth.
The Bruins controlled the play in the first half but led only 24-14 at the break because Cal converted a pair of fumbles into two short touchdown drives.