STANFORD, Calif. - David Shaw, the Bradford M. Freeman Director of Football, knew there would be growing pains with his 21st-ranked team. When you lose two first-round picks to the NFL, it takes time to reload.

The Cardinal was far from flawless Friday night in a tense 20-17 victory over gritty San Jose State in the "Bill Walsh Legacy Game" watched by an announced crowd of 40,577 at chilly Stanford Stadium. But Shaw saw plenty of positive performances, including the baptism of a senior quarterback Josh Nunes and 10 true freshmen to feel good about his team going forward.

"There are going to be some bumps and bruises," he said. "In four or five games, we should be the team we need to be. There are some guys who need to grow up quick."

Playing the first-ever Friday night home game in school history, the Cardinal (1-0) jumped out to a quick 17-3 lead and seemed poised to put the Spartans (0-1) away early. But San Jose State battled back to tie the game, limiting the Stanford offense to three points and five first downs in the second half. Junior Jordan Williamson's 20-yard field goal with 13:15 remaining in the fourth quarter provided the margin of victory.

"They played well," said Shaw. "We didn't play as well. If we executed better, there should have been a bigger separation on the scoreboard. When we needed it, our defense showed up."

Junior free safety Ed Reynolds sealed the win with a fourth down interception of Spartan quarterback David Fales with 1:10 left in the game.

"From film study, we knew 82 (Ryan Otten) was the quarterback's guy," Reynolds said. "I saw the quarterback look back a little too long. It was great to have the pass rush get him out of the pocket."

The Cardinal, now 51-14-1 in the series, won for the ninth time in the last 10 meetings. Stanford has now prevailed in 24 of its last 27 home games.

"Should of, could have, would have," said San Jose State head coach Mike MacIntyre. "Should have won it and have a lot of broken-hearted kids there that played their butts off. But then again, Stanford made some plays to win the game so I tip my hat to them."

Nunes, taking over from two-time Heisman Trophy runner-up Andrew Luck, managed the game well, completing 16-of-26 passes for 125 yards and one touchdown, and was not intercepted.

"Josh played great," said Shaw. "He showed great leadership. I'm very proud of him. He never flinched all game."

Nunes showed poise and never panicked.

"It was everything I dreamed," he said. "I wasn't nervous at all. It was nice being back on the field again. We have a lot to clean up."

Senior running back Stepfan Taylor eclipsed the 100-yard mark for the 14th time in his career. He amassed 116 yards on 26 carries and scored one touchdown. But like his coach, Taylor saw lots of room for improvement.

"We didn't hit them in the mouth," he said. "San Jose came out with a plan, and they executed it. We'll watch the film. We can play better."

Defensively, senior nickel back Usua Amanam, making his first collegiate start, was all over the field. Of his six tackles, four were behind the line of scrimmage and he also recovered a fumble.

"He's not the biggest guy, but about the most determined guy," said Shaw. "He played a great game."

Stanford won the opening toss and elected to receive. The Cardinal promptly drove 82 yards on 13 plays, culminated by a 1-yard run by Taylor on fourth and goal with 8:28 remaining in the first quarter.

Taylor was a workhorse on the drive, rushing for 61 yards on nine carries, including a 38-yard gallop. Sophomore running back Remound Wright converted a key fourth-and-one from the Spartan 10 to extend the march. Nunes completed his first two pass attempts to sophomore wide receiver Ty Montgomery.

Following a three-and-out by the Cardinal defense, the offense regained possession at midfield. Nunes connected with Montgomery for a 9-yard completion, which was extended 11 yards by a facemask penalty. Nunes capped the swift six-play drive with a perfectly thrown 11-yard scoring pass to senior wide receiver Drew Terrell, who beat his defender in the back right corner of the end zone. It was the second career touchdown catch for Terrell and first touchdown pass for Nunes. With 4:23 remaining, Stanford led, 14-0.

The Spartans cut into the lead with 10:23 remaining in the second quarter on a 38-yard field goal by Austin Lopez. Key plays were a 20-yard pass from Fales to tight end Ryan Otten, and a 20-yard end around by wide receiver Chandler Jones.

Both defenses stiffened until late in the quarter, when Terrell returned a Spartan punt 17 yards to his own 31. With 1:23 remaining and only one timeout, Nunes calmly found with Terrell for 10 yards and senior tight end Zach Ertz made a nice diving catch for 11 yards. Williamson ended the half by booting a career-long 46-yard field goal as time expired to extend the lead to 17-3.

San Jose State took the second half kickoff and drove 78 yards in nine plays, with sophomore quarterback Blake Jurich covering the final three yards with a burst off left tackle into the end zone. Fales was effective through the air, completing three big passes, two on third down. He found tight end Peter Tuitupou for 20 yards, then hit wide receiver Noel Grisgsby for 21 and 20 yards, the latter just over the out-stretched hands of Reynolds down to the Cardinal 7. With 11:08 remaining in the third quarter, Stanford led 17-10.

After a Cardinal punt, the Spartans tied the game on a 21-yard touchdown pass from Fales to Grigsby. San Jose converted three key first down plays during the 12-play, 82-yard drive, including a 13-yard run from Jurich to the Stanford 21. With 2:17 left in the quarter, the score was tied 17-17.

Just before the quarter ended, the Cardinal defense produced a big turnover when Reynolds jarred the ball loose from running back De'Leon Eskridge and Amanam recovered at the Spartan 38-yard line. That set up the 20-yard field goal by Williamson.