PASADENA, Calif. (AP) — UCLA contained Christian McCaffrey, kept Stanford’s offense out of the end zone and generated just enough points to lead the Pac-12 champions until the Cardinal’s final drive.

And then everything reverted to usual form in this one-sided California rivalry.

J.J. Arcega-Whiteside caught an 8-yard touchdown pass from Ryan Burns with 24 seconds to play, and No. 7 Stanford rallied for its ninth consecutive victory over the Bruins, 22-13 on Saturday night.

McCaffrey rushed for 138 yards for the Cardinal (3-0, 2-0 Pac-12), but they struggled on offense for 3 1/2 quarters. Stanford got the ball back with 2:05 left and coolly put together a 70-yard drive capped by Burns’ fade to Arcega-Whiteside, who got one foot inbounds on an acrobatic play.

“We just kept our composure from the time we started to the time we finished,” Arcega-Whiteside said. “We made mistakes, but you could sense in those last two minutes that we were all going to execute. When we do it, it all pays off.”

Solomon Thomas then returned Josh Rosen’s fumble 42 yards for a touchdown on the game’s final play, punctuating the heartbreak for a lively Rose Bowl crowd. Even with that TD, Stanford had its lowest-scoring performance since the 2015 season opener.

PAIN WITHOUT GAIN

Another stirring Stanford victory was another soul-crushing loss for the Bruins (2-2, 0-1), who haven’t beaten their upstate rivals since 2008. They had never even led the Cardinal for more than six minutes in any of those eight straight losses, but UCLA nursed an advantage in this one for nearly three quarters — until Stanford snatched it away again.

“That’s about as difficult as it gets,” said UCLA coach Jim Mora, who has never beaten Stanford’s David Shaw. “It stings when you lose like that, and played so courageously on defense, and done such a great job against a really good team, and they make the play. Doesn’t matter who you play. Losing like that is just awful.”

ROSEN’S VOW

Rosen passed for 248 yards for the Bruins, hitting Nate Iese for his only touchdown in the first half. He got the Bruins to midfield in the final seconds, but couldn’t reach field goal range before fumbling on a sack from behind.

The sophomore passer still thinks UCLA can rally to make the Pac-12 title game.

“It’s one of the top teams in our conference, and we’re going to see them again,” Rosen said. “We’re a million percent going to see them again.”

THE TAKEAWAY

STANFORD: The Cardinal barely escaped with yet another victory, but UCLA’s defense might have provided clues to other teams about how to control McCaffrey and the seemingly unstoppable Stanford offense. This is the type of victory that great programs get, and Shaw’s unlikely powerhouse proved its tenacity yet again.

UCLA: The Bruins changed their offensive approach and bulked up their defensive line in the offseason, all with the intention of matching Stanford’s brute strength and deceptive sophistication. The positive changes weren’t evident in the Bruins’ first three games, but they showed up in this matchup — just not quite long enough for a win.

POLL IMPLICATIONS

STANFORD: The Pac-12’s highest-ranked team and preseason favorite will stay in the top 10 , but it wasn’t impressive. The Cardinal won’t move up, but No. 8 Michigan State’s loss means they aren’t likely to slide much, either.

UCLA: Nope.

UP NEXT

STANFORD: This trip had trap-game potential due to the Cardinal’s visit to No. 9 Washington on Friday night in a game that could establish early supremacy in the Pac-12 race.

UCLA: The Bruins stay home for a visit from Arizona after shaking off this heartbreaker.

___

AP college football website: www.collegefootball.ap.org