Updated

Oregon State is much improved on defense. Just ask Stanford.

The Beavers had their best defensive performance of the season in Saturday night's 20-12 loss to the Cardinal. Oregon State held Stanford to 273 yards for the Cardinal's lowest total in 14 games.

OSU's defense all but eliminated Stanford's passing game, which came into Saturday averaging 207 yards. Against the Beavers, Cardinal quarterback Kevin Hogan completed just 8 of 18 passes for 88 yards and no touchdowns.

It's a dramatic development from Oregon State's opener, when Eastern Washington had 448 yards passing in a 49-46 victory.

"That was really, really good football," Oregon State coach Mike Riley said of his defense. "I thought (defensive coordinator) Mark Banker and the rest of the defensive staff had a great plan. The kids played hard. They played to perfection."

After giving up 625 yards to the FCS Eagles and 539 yards to Utah early in the season, Oregon State's defense has surrendered less than 400 yards in each of its past four games.

OSU came into Saturday ranked ninth in the Pac-12 in pass defense, but gave up only three pass plays longer than 10 yards to the Cardinal. Oregon State's pass rush sacked Hogan twice and had the junior scrambling for most of the game.

"This is the most pressure we have faced," Stanford coach David Shaw said.

Oregon State's defense was opportunistic, with the Beavers using two fumble recoveries to gain momentum.

Stanford's offense began the game with a long drive that ended when Oregon State defensive end Scott Crichton had a 36-yard fumble return. With 4:13 remaining and the Cardinal leading 20-9, Oregon State's Dylan Wynn recovered Tyler Gaffney's fumble at the Stanford 20. The Beavers turned the fumble into a field goal, and nearly forced overtime a few minutes later after driving inside the Stanford 10 during the final 30 seconds.

Still, there is room for improvement for the Beavers.

Stanford, which moved up two spots to No. 6 when The Associated Press poll was released on Sunday, probably won the game with a two-touchdown burst midway through the game.

OSU was working on a shutout before Stanford marched 66 yards for a touchdown with 7 seconds left in the second quarter to make it 7-3 at the break. Then OSU's Victor Bolden fumbled the second-half kickoff and Stanford got another TD 52 seconds into the third.

"You can't give them chances like that. Against a good team you have to play mistake free," Oregon State cornerback Rashaad Reynolds said.

After that difficult stretch, the Beavers' defense allowed Stanford just three first downs the rest of the game.

"We learned that we are a resilient bunch. There were times in this game that we could have given up, but we just kept fighting and fighting," Reynolds said. "This is something we can hang out hats on and move forward."