Arizona State (10-3) stumbled early for the second straight game against the Cardinal and never really recovered to spoil its Rose Bowl hopes.
D.J. Foster accounted for 142 total yards and two touchdowns for the Sun Devils, who will likely play in the Holiday or Alamo Bowl instead of making their first trip to Pasadena since 1997.
Kevin Hogan threw for 277 yards and a touchdown, Ty Montgomery scored two touchdowns and Stanford held Arizona State to 311 total yards to earn a spot in a BCS bowl for the fourth straight season.
These teams met Sept. 21 in a game of huge momentum swings.
Stanford raced to 39-7 lead, but Arizona State stormed back with three touchdowns in the fourth quarter.
The Cardinal won 42-28 and the Sun Devils wondered what would have happened if they had gotten off to a better start or had more time to finish off the comeback.
A lot happened in the 11 weeks since that game: Arizona State won seven straight to get into the title game and Stanford earned a spot despite losing twice.
The Cardinal got off to another fast start in the rematch: Gaffney raced 69 yards down the sideline on the game's second play for a touchdown that turned the raucous crowd inside Sun Devil Stadium nearly silent.
The Sun Devils had a quick counterpunch this time, scoring on their fifth play when Foster charged through up the middle for a 51-yard touchdown, eclipsing Arizona State's entire rushing total (50) from the first meeting.
But Stanford followed with a series of body blows, gouging out big plays behind its massive offensive line.
Gaffney scored on a 1-yard run after Hogan hit Jordan Pratt on 35-yard pass. Montgomery scored on the first play of the second quarter, racing in 22 yards on an end-around after Hogan connected on a 42-yard pass to Devon Cajuste. A 29-yard run by Anthony Wilkerson set up Foster's third TD, a fourth-down dive that put the Cardinal up 28-7 early in the second quarter.
Arizona State finally showed signs of life late in the quarter, when Foster broke a tackle and turned a swing pass into a 65-yard touchdown that cut the lead to 28-14.
The Sun Devils had a couple of scoring chances in the third quarter and came up empty.
Zane Gonzalez ended his school-record streak of made field goals 18 by missing a 31-yarder and Stanford's Zach Hoffpauir came off the corner to stuff De'Marieya Nelson on fourth-and-goal from the 1.
Stanford put it out of reach thanks to another big play early in the fourth quarter.
Hogan hit Cajuste on a 78-yard pass, then found Montgomery on a 24-yard touchdown throw to put the Cardinal up 38-14.
Storylines Cardinal rulein Pac-12
R Stanford beats Arizona State 38-14 in the Pac-12 championship game to get a shot at a second straight Rose Bowl victory.
• Tyler Gaffney runs for 133 yards and three touchdowns, and Stanford racks up 517 yards of total offense.