The Cardinal (11-2) will play the winner of the Big Ten title game between Nebraska and Wisconsin in the Rose Bowl on Jan. 1.
UCLA's Brett Hundley threw for 177 yards and a costly interception that set up a Stanford touchdown. He still almost brought the Bruins (9-4) back, but Ka'imi Fairbairn missed a 52-yard field goal wide left in the closing moments of the disappointing loss.
Hogan completed 16 of 22 passes for a fourth win over a ranked opponent in his fourth straight start since unseating Josh Nunes at quarterback. After the Cardinal rolled past UCLA 35-17 last Saturday at the Rose Bowl, it took all 60 minutes to secure another victory in a rare rematch.
Scattered showers made the grass a bit slick, though the surface never seemed to slow down the Bruins, who ran for 284 yards with Johnathan Franklin (194 yards) leading the way. It was the most yards rushing allowed this season by Stanford, which yielded 198 in an overtime victory at Oregon two weeks earlier.
The Cardinal did just enough to win their seventh straight game and advance to their third different BCS bowl in as many seasons. They have won at least 11 games each year, part of a run that began behind Harbaugh and Luck, and now has carried on with Shaw and Hogan.
Stanford had won 10 games only three times before in program history (1992, 1940 and 1926).
"It's been a good month," Hogan said. "We've been playing well. Especially for me, just being able to play, it's been fun. The guys around me make it a lot easier than it looks."
The Bruins made the final roadblock more difficult than expected.
UCLA converted a pair of third downs before Franklin burst through the middle for a 51-yard touchdown on the game's opening drive. He carried safety Jordan Richards the final 5 yards into the end zone.