Updated

Stepfan Taylor's 21-yard touchdown run in the first overtime period lifted the 18th-ranked Stanford Cardinal over the Arizona Wildcats, 54-48.

Stanford's defense came up big in overtime. On Arizona's fifth offensive play, Matt Scott had his pass deflected at the line of scrimmage and Chase Thomas came up with the interception. Taylor then found a hole up the middle and sprinted 21 yards into the end zone for the come-from-behind victory.

"It was the difference in the game," Stanford coach David Shaw said of the defense stepping up. "When you're in a seesaw battle and going back and forth, the team that gets the stops on defense wins. And we got a big stop in the fourth quarter, which gave us a chance, and then, the stop in the red zone in the overtime is the game."

Taylor carried the ball 31 times for 142 yards and two scores for the Cardinal (4-1, 2-1 Pac-12), who have won nine straight games in the month of October dating back to Oct. 9, 2010.

Josh Nunes completed 21-of-34 passes for 360 yards and two touchdowns for Stanford, which bounced back from a 17-13 loss to Washington on Sept. 27. Nunes also carried the ball seven times for 33 yards and three scores.

Levine Toilolo caught five passes for 141 yards and a touchdown for the Cardinal, who play Notre Dame next weekend.

Scott connected on 45-of-69 passes for 491 yards, three touchdowns and one interception for the Wildcats (3-3, 0-3), who have lost three in a row.

Ka'Deem Carey carried the ball 29 times for 132 yards and three scores. Austin Hill caught 11 passes for 165 yards and two touchdowns.

Trailing 48-34 in the fourth quarter, Nunes scored a pair of rushing touchdowns to force overtime. Drew Terrell recovered his own fumble after catching a 16-yard pass on 3rd-and-8. He followed that up with a 14-yard catch to the Arizona 28. On 4th-and-2, Toilolo hauled in a 19-yard pass. Nunes capped the 60-yard drive with a 1-yard TD run.

After Arizona went three-and-out, the Cardinal put together a 14-play, 79-yard scoring drive. Nunes kept the march alive with a 16-yard run on 3rd-and-7 from midfield. On 4th-and-9 from the 20, Zach Ertz caught a 17-yard pass. Nunes followed with a 3-yard rushing TD to make it 48-48 with 45 seconds remaining.

The Wildcats decided to run the clock out and go to overtime.

Stanford started the game with an 11-play, 65-yard scoring drive that Ertz capped with an 11-yard TD catch. The remainder of the first quarter was filled with punts.

Arizona tied the contest early in the second stanza. Dan Buckner caught a 31- yard pass to move the ball to the Cardinal' 13. On the next play, Carey ripped off a 13-yard touchdown run.

The Wildcats' next drive lasted 17 plays but only resulted in a 33-yard John Bonano field goal.

The Cardinal responded with a touchdown to take the lead back. Toilolo hauled in a 12-yard pass in the right corner of the end zone, making it 14-10 with 2:48 left.

Bonano made a 33-yard field goal before the half to make it 14-13.

A back-and-forth third period featured 20 points from each team. Carey had a 1-yard rushing TD and Hill caught a pair of touchdown passes for the Wildcats, while Nunes, Taylor and Kelsey Young each had a rushing touchdown for Stanford. Young's 55-yard score gave the Cardinal a 34-33 edge with 28 seconds remaining.

The Wildcats scored the first 15 points of the fourth quarter to go in front. Arizona started the frame with a 10-play, 75-yard drive. Hill and Buckner caught passes of 24 and 14 yards, respectively, before Carey ripped off an 8- yard TD run. A successful two-point conversion made it 41-34.

"Almost every game we try to stretch the field," Hill said. "We have a great set of receivers and Matt Scott's been throwing the ball great. We took advantage of a lot of their secondary miscues, and that helped a lot."

On the third play of Stanford's ensuing possession, Ty Montgomery fumbled the football following a 16-yard catch. Arizona recovered at the 45 of the Cardinal. Carey hauled in a 24-yard pass to move the ball into the red zone. Terrence Miller capped the six-play drive with a 9-yard catch in the left corner of the end zone, giving Arizona a 48-34 margin with 9:13 to play.

"Being down 14, he kept his poise and drove us down the field," Taylor said of Nunes. "He had a lot of passes those last few drives, and they were converting. We stuck together as a team and had trust in each other."

Game Notes

The all-time series is now tied, 14-14. Stanford has won eight of the last 10 meetings ... Each team racked up 617 yards of total offense ... Arizona had 491 passing yards.