CORVALLIS, Ore. -- This was the type of game where No. 8 Stanford thrives, the sort of bare-knuckled, physical brawl where yards and points are hard to come by.
Tyler Gaffney ran for three touchdowns and the Cardinal 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). Stanford totaled 276 yards of offense as quarterback Kevin Hogan completed just 8 of 18 passes for 88 yards.
Oregon State didn't top 300 yards either, held to 288 - 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.
Beavers receiver Brandin Cooks, tops in the nation in receptions and yards, finished with nine catches for 80 yards.
"Defensively, I thought we played extremely well, against the No. 1 quarterback and the No. 1 receiver in the nation. To hold Cooks down was phenomenal," Stanford coach David Shaw said.
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.
It wasn't pretty for the Cardinal offense, and in particular, Hogan. The Beavers' defense had him scrambling, and Hogan was able to complete only three passes longer than 10 yards.
"We should have played better in the passing game. I can't tell you exactly why, or what happened new. One thing I knew is this is the most pressure we have faced," Shaw said.
But Gaffney, who leads Stanford in rushing with 878 yards this season, picked up the slack. Gaffney, who often gained yardage after the first contact, was effective in the second half, when he ran for 79 yards and two touchdowns.
"If you can just get those extra yards, it's something I take on myself as a pride thing, and you know, I think Stanford football is about it," Gaffney said.
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.
Twice during the first half and once in the third quarter, Oregon State coach Mike Riley decided to pass up field-goal attempts, and instead tried to convert a fourth-and-short. Stanford turned back each one.
Cooks said the coach made the right call.
"That's what you have to do in big-time games. It's not on him. We've got to make those plays," Cooks said.
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.