TEMPE, Ariz. -- Heisman Trophy contender Andrew Luck threw an interception and fumbled. The running backs seemed to be spinning their wheels in sand against Arizona State's speedy gang tacklers.
After piling up scores and wins, Stanford's offense had become uncharacteristically ineffective.
The defense new exactly what to do: keep the game close, get the ball to Luck for one final drive.
It worked to perfection.
Luck threw for 292 yards and engineered a long fourth-quarter scoring drive to set up Owen Marecic's second 1-yard touchdown dive, lifting the Cardinal (No. 6 BCS, No. 7 AP) to a defense-dominated 17-13 win over the Sun Devils Saturday night.
"When you have the best quarterback in the nation, a Heisman candidate on the other side of the ball, you just have do your job and keep them out of the end zone," Stanford cornerback Richard Sherman said. "No matter how long it takes, he's going to get it done."
Stanford (9-1, 6-1 Pac-10) had to suffer through an in-the-trenches fist fight to get there.
Accustomed to cruising to victories this season, the Cardinal labored against Arizona State's speedy defense, unable to do much on the ground or through the air.
The Cardinal defense did its job, though, holding the Sun Devils (4-6, 2-5) to 268 yards to give Luck one final chance.
He came through, as usual, guiding Stanford 85 yards in 10 plays to set up Marecic's bulldozing TD run with just over 5 minutes left. The defense came back out and held, and the offense was able to grind away the final 4 minutes to give the Cardinal their first win in Tempe since 1999.
"I think this is the kind of game that brings your guys together," Stanford coach Jim Harbaugh said. "You rely on each other, you trust in each other and every play is critical. They feel good about each other now after that game, and the reason they do is that they know they themselves and their teammates played like champions. Champions win those type of games."
Arizona State played another good team tough, only to fail again down the stretch.
The Sun Devils stifled Stanford's running game, holding the Cardinal to 128 yards on 42 carries. They also forced Luck to throw underneath instead of downfield, prevented him from hurting them with his legs and forced the two turnovers.
It just wasn't enough.
Arizona State's offense mustered just two scoring drives and the defense caved when it needed a stop the most, giving up the late, game-deciding drive -- helped along by linebacker Vontaze Burfict's consecutive penalties on the same play -- to lose its 11th straight against a Top 25 opponent.
"It's another tough one," Arizona State linebacker Colin Parker said. "We fought our hearts out and made some mistakes during the game. We didn't capitalize on certain opportunities and let this one slip away."
The Cardinal needed this win to keep their long shot Rose Bowl hopes alive.
Stanford has its best 10-game start since 1951 and highest ranking since 1970, but needs an improbable string of wins and losses by other teams to get to Pasadena for the first time in a decade.
With no other choice but to shrug off the incongruity of their season, the Cardinal were taking a narrow view instead of big-picture focus.
Stanford needed it against an Arizona State team that's gone through a season of close games.
Other than a lopsided loss to Cal, the Sun Devils have been in every game, playing top-ranked Oregon its closest game of the season, and losing three games by three points or less.
"We knew it was going to be a 60-minute football fight," Harbaugh said.
It was, at least after an initial scoring burst.
That came within the game's first three drives, when Marecic scored his first TD and Steven Threet tied it with a 4-yard run.
Then the defense took over.
Arizona State stuffed Stanford on a fourth-and-1 near midfield, only to give the ball back on the next drive, when Stanford recovered a fumble in the end zone after cornerback Michael Thomas hit Threet as he was diving for the goal line.
Oliver Aaron later sacked and stripped Luck -- the fourth allowed by Stanford all season -- and the Sun Devils recovered to halt another drive.
Despite its offensive struggles, Stanford had a chance at the halftime lead, thanks to Luck's falling-down 44-yard completion to Doug Baldwin, but the officials ruled Nate Whitaker's 34-yard field goal wide right.
Harbaugh couldn't believe it, yelling "It was good!" before waving his hand in disgust.
It was that kind of game for Stanford.
The nation's fifth-highest scoring team -- 30 points in a school-record nine straight games coming in -- the Cardinal found themselves tied at halftime for just the second time this season and in need of a spark.
It came late, giving Stanford a spirit-boosting win and Arizona State another near miss.
"We've lost some real close ones that kind of tell the story of the season," Arizona State coach Dennis Erickson said. "We could be whatever we could be, but that's not the case."