CORVALLIS, Ore. (AP) -- Tyler Gaffney ran for three touchdowns and No. 8 Stanford held off Oregon State's fourth-quarter comeback bid in a 20-12 win Saturday night.
Gaffney ran 22 times for 145 yards and scored on runs of 4, 9 and 32 yards to highlight a slow offensive night for Stanford (7-1, 5-1 Pac-12). The Cardinal totaled 276 yards on offense, as quarterback Kevin Hogan completed just 8 of 18 passes for 88 yards.
Stanford held Oregon State to 288 yards, well off the Beavers' season average of 515 yards. OSU quarterback Sean Mannion, the national leader in yards passing and touchdown passes, was 41 of 57 for 271 yards and one touchdown.
The Beavers (6-2, 4-1) trailed 20-9 with less than 4 minutes remaining and nearly forced overtime. Down by eight, Oregon State drove to the Stanford 7 with 30 seconds remaining, but four consecutive incompletions stopped the rally and ended the Beavers' six-game winning streak.
The Cardinal win sets the stage for a showdown against No. 2 Oregon at home on Nov. 7. Last year, Stanford handed the Ducks their only loss of the season with a 17-13 win in Eugene.
Stanford's defense came up big in key situations, as it turned back Oregon State on downs four times inside the Cardinal 35. Stanford held Mannion to less than 350 yards passing for the first time this season, and sacked him eight times.
Stanford led 7-3 at halftime following a defensive struggle in the first half.
Oregon State took a 3-0 lead early in the second quarter on Trevor Romaine's career-best 50-yard field goal. The Beavers appeared that they would lead hold the lead into the break when a turnover on downs gave the Cardinal the ball on its own 34 with 46 seconds remaining in the second quarter.
Stanford took advantage with a quick-striking drive, finishing when Gaffney bulled into the end zone from 4 yards out 7 seconds before halftime.
The Cardinal capitalized on their momentum by forcing a fumble on the opening kickoff of the second half. Gaffney scored two plays later on a 9-yard run to put Stanford ahead 13-3.
Oregon State bounced back with its best possession of the night, a 12-play, 90-yard drive ending on an 8-yard touchdown pass from Mannion to Brandin Cooks. But the Cardinal made it 20-9 just 3 minutes into the fourth quarter on Gaffney's 32-yard cutback run for a touchdown.
Romaine had 39-yard field goal with 3:57 left to pull the Beavers to 20-12.
NOTES: Injuries left Stanford without two key players in WR Devon Cajuste (knee) and K Jordan Williamson (leg). Sophomore Conrad Ukropina kicked in Williamson's absence. ... Terron Ward's 34-yard run midway through the third quarter was Oregon State's longest running play of the season. ... Romaine missed his first extra-point kick in 37 tries this season.