STANFORD, Calif. (AP) - Zach Maynard finished with 280 yards passing and two touchdown throws for the Golden Bears, but Cal fell short to Stanford 31-28 on Saturday night in a rain-soaked Big Game.

The Golden Bears (6-5, 3-5) faced the Cardinal for the 114th edition of the Bay Area rivalry. Cal scored 15 points in the fourth quarter, including a C.J. Anderson 1-yard touchdown with 14 seconds left. But Stanford recovered the onside kick to clinch the contest.

Luck tossed scores to Levine Toilolo and Ryan Hewitt, keeping the Cardinal's slim chances of a Pac-12 title alive. He overcame an early interception by Cal cornerback Steve Williams and rallied Stanford (10-1, 8-1) from six points down to make sure The Axe stayed on The Farm for the second straight season.

With a steady stream of rain falling, Luck connected with Toilolo for a 4-yard touchdown on the opening drive of the third quarter to extend the Cardinal's lead to 21-13. Stanford stifled Cal's offense and quickly put the ball back in the hands of its star quarterback.

Luck wasted little time.

He found Toilolo for a 41-yard gain and finished off the drive with a 10-yard touchdown pass to fullback Hewitt to put Stanford in front 28-13.

In the fourth quarter, Maynard led a 68-yard drive ending with a three-yard TD pass to Spencer Hagan on third down. After a 2-point conversion on a pass to Marvin Jones, Cal cut Stanford's lead to 28-21 with 10:53 left.

All that time quickly vanished.

Stanford grinded out 7:40 with a 14-play, 57-yard drive with a series of short runs and passes on slick, soggy field that had defenders sliding in every direction. Even running backs, too.

"It was kind of frustrating because they were running the ball a lot right up the middle of the field and controlling the clock," Maynard said. "We had to hurry up and run a two-minute offense, and after that, we just ran out of time."

Jordan Williamson, who missed a 33-yard field goal wide left in the first half and hadn't played in the last three games because of an undisclosed injury, kicked a 35-yard field to give the Cardinal a two-score cushion.

"You've got to have faith in your players," Stanford coach David Shaw said. "He missed a kick, but that was the right decision at the time."

That proved pivotal when Anderson's TD run for the Bears with 14 seconds left pulled Cal within 31-28. But Stanford tight end Coby Fleener recoved the onside kick.

One year ago in Berkeley, the Cardinal beat the Bears 48-14. Cal left Stanford with a 34-28 victory in 2009.

"Any time you lay it all out there like our guys did, these guys have absolutely nothing to be ashamed of," Cal coach Jeff Tedford said. "They played their hearts out against a really good football team."

Stanford recovered Maynard's wayward pitch back on the game's opening drive and took over at its own 37. Three plays later, freshman Ty Montgomery took a reverse and sprinted 34 yards down the sideline to put the Cardinal ahead 7-0.

Williams stepped in front of a falling Montgomery to intercept Luck's pass midway through the first quarter and return it 49 yards for a score that was called back because of an illegal block in the back.

But three plays later, Maynard found Keenan Allen for a 17-yard TD pass and a 10-7 Bear advantage. Giogio Tavecchio kicked his second field goal of the game from 19 yards to give Cal a 13-7 lead in the second quarter.

Isi Sofele rushed for 92 yards on 21 attempts for the Bears, while Sean Cattouse and Mychal Kendricks each tallied a game-high-tying 13 tackles. Kendricks added 2.5 tackles for loss for -18 yards and a sack for -14. Cattouse had a tackle for loss for -2 yards and a pass breakup.