Ranked No. 2 in the country and facing a team that beat them three times in a row, the USC Trojans and quarterback Matt Barkley were ready to change things. Too bad they didn't let No. 21 Stanford know about their plans.

Quarterback Josh Nunes led the Cardinal on a scoring drive in the fourth quarter that resulted in a 37-yard touchdown, putting them ahead 21-14 for the victory. Nunes is starting this year for the first time, replacing former Stanford quarterback, Heisman candidate and No. 1 overall pick in the NFL draft, Andrew Luck.

"We don't want to be that team known for one victory," Stanford coach David Shaw said to the Associated Press. "We want to be known for victory after victory, stacking wins on top of wins."

USC quarterback Matt Barkely had a solid game, passing for 254 yards, but he was intercepted twice and was also sacked two times on the Trojans final drive.

"You learn and go back to playing Trojan football," said a disappointed Barkley, who has beaten every conference teams but is 0-4 against Stanford. "We got to just not put the blame on anybody, learn from our mistakes and make sure we bounce back."

The loss made it four in a row against Stanford for USC and the fifth in six years. The fans at the sold-out Stanford Stadium rushed the field after the game, creating a huge blob of red at midfield.

"I love the energy and I love the enthusiasm," Shaw said. "But we are not surprised."

Running back Stepfan Taylor had 153 yards rushing and also added two touchdowns, including a receiving touchdown that tied the game at 14 in the third quarter. Taylor took a screen pass on the sideline and broke a tackle to get into the endzone.

USC had looked like one of the best teams in the nation the first two weeks and is still poised to make a national title run following a two-year bowl ban for NCAA violations.

"It's not the end of the world," said USC coach Lane Kiffin said, now 0-3 against Stanford. "We'll get back on the plane, go home and we'll get better."

The Trojans had difficulty running the ball and were outgained by Stanford 202 to 26. USC also gave up three turnovers and were only 1 of 13 on third down conversions.

Stanford improved to 3-0 for the third straight year. Last season Stanford beat the Trojans in a triple-overtime game 56-48.

Stanford will play another Pac-12 foe on Sept. 27, visiting the Washington Huskies, while USC will host the California Golden Bears on Sept 22.