STANFORD, Calif. (AP) -- Don't count Stanford out of the Pac-12 race just yet.
The Cardinal's physical ground game and dominant defense - which disappeared in a loss at Utah last week - showed they can still shut down new-age offenses the old-fashioned way.
Tyler Gaffney ran for a career-high 171 yards and two touchdowns, and No. 13 Stanford smothered Brett Hundley and No. 9 UCLA 24-10 on Saturday with a physical performance on both sides of the ball.
''You hear the expression, 'Offense is your best defense.' You keep them off. They can't do anything,'' said Gaffney, who also carried the ball a career-most 36 times.
The Cardinal outgained UCLA 419 yards to 266, won the time of possession 37:11 to 22:49 and again made the big plays when it mattered most.
Kevin Hogan threw for 227 yards and a spectacular touchdown to Kodi Whitfield as the Cardinal (6-1, 4-1) regrouped the way they always seem to over the past four years. Stanford has not lost consecutive games since October 2009.
''It's been a staple of ours for some time now,'' Cardinal coach David Shaw said.
The Bruins entered the game averaging 45.8 points per game. That ranked second in the Pac-12 behind Oregon, which hosts UCLA next week before traveling to North Division rival Stanford on Nov. 7 in matchups that will likely decide the Pac-12's championship game.
Just as they slowed down Marcus Mariota and Oregon last season, Stanford hurried Hundley all afternoon to put the brakes on UCLA's up-tempo offense.
Hundley completed 24 of 39 passes for 192 yards, one touchdown and two interceptions by Jordan Richards - the second with a little more than 2 minutes remaining, leading to another Stanford touchdown that put the first blemish on UCLA's season. The Bruins (5-1, 2-1) have not started 6-0 since 2005.
''That was just a really difficult loss for this team,'' UCLA coach Jim Mora said. ''We struggled to get things going the way we're capable of getting things going, and that's not like us offensively.''
The Cardinal came out on top again in a rematch of last season's Pac-12 title game with a ''back-to-basics'' formula.
With UCLA's offense taking the field with 2:57 remaining, the Cardinal harassed Hundley into two incompletions before Richards dived for his second interception at the Bruins' 32-yard line after receiver Thomas Duarte fell down. Then Gaffney capped off a quick Stanford drive with a 4-yard TD run that put the game out of reach.
''He holds the key to their offense,'' linebacker Trent Murphy said of Hundley, getting Stanford's fourth sack of Hundley on the final play for an exclamation point. ''We wanted to stop him.''
Stanford has won six straight over UCLA, including three in the last year, and 14 in a row against teams from California.
Devon Cajuste caught seven passes for 109 yards for Stanford before leaving with a right leg injury early in the fourth quarter. His status for next week at Oregon State is uncertain, Shaw said.
UCLA also lost a key player, with inside linebacker Eric Kendricks taken to the hospital for tests on his kidney after making nine tackles in the first half. It was not immediately clear what caused Kendricks' kidney issue, but Kendricks' kidney passed initial tests and he was traveling back to Los Angeles with the team.
The remaining players for UCLA, which entered the game outscoring opponents 71-0 in the third quarter, looked out of rhythm after halftime. Stanford outscored UCLA 14-3 in the third quarter to take a two-touchdown lead - with one of the most spectacular plays of the season igniting Stanford's surge.
While running to his right on a post route, Whitfield - the son of former NFL offensive lineman Bob Whitfield - leaped in the air and reached back to make a backhanded catch with his right hand between two defenders. The 30-yard TD reception put Stanford up 10-3 and left most of the crowd ''oohing'' every time the replay was shown on the video boards.
''Hogan gave me a chance,'' Whitfield said. ''I saw the ball and just thought, 'Got to catch this.'''
On UCLA's next drive, Stanford forced a turnover for the 32nd straight game - the second-longest streak in the country - when Richards intercepted Hundley's lofted pass. Richards' return for a touchdown was called back because of a holding penalty.
Cajuste caught a leaping 34-yard pass at UCLA's 2 on third down. And three plays later, Gaffney ran for a short TD to put the Cardinal up 17-3 late in the third quarter.
Hundley regrouped to lead UCLA on an 11-play, 75-yard scoring drive. He capped it off with a 3-yard TD pass to Shaquelle Evans that sliced Stanford's lead to 17-10 early in the fourth.
Hundley and the Bruins never looked so smooth again. Ka'imi Fairbairn kicked a tying 38-yard field on the opening drive of the second half for UCLA's only other score.
''Games like this you want to win so bad,'' Hundley said. ''That's really all I can say. You want to win these games so bad, so bad.''