TEMPE, Ariz. -- Stanford controlled the ball on offense, prevented big plays on defense. The Cardinal put together a couple of key scoring drives and limited Arizona State's chances for a comeback.
It's just the way Stanford wins game -- and just what the Cardinal needed after a two-game losing streak.
K.J. Costello threw for 231 yards and a touchdown, and Stanford remained in the thick of the Pac-12 North Division race with a 20-13 win over Arizona State on Thursday night.
"We could have played better, obviously, but for us, this is the way we needed to win this football game," Stanford coach David Shaw said. "What we've done the last couple games, coming up short, not giving ourselves a chance, we gave ourselves a chance today."
Stanford dropped out of the College Football Playoff picture and the Pac-12 North lead with losses to No. 4 Notre Dame and Utah.
Arizona State was maybe not a must-win game, but the Cardinal certainly could have used it after being outscored by a combined 68-38 the previous two games.
Stanford (5-2, 3-1) needed a half to get its offense fully rolling off a bye week, held to a pair of field goals in the first half. The Cardinal put together a pair of impressive drives in the third quarter and had a 16-minute advantage in time of possession to tie No. 14 Washington atop the Pac-12 North.
Arizona State (3-4, 1-3) was held to a field goal in the first half before Manny Wilkins scrambled for a 10-yard touchdown run in the fourth to pull the Sun Devils within 20-13.
Arizona State got the ball back at its own 16 -yard line with 2:20 left, but couldn't get off a final play from Stanford's 20 after a short gain.
Wilkins threw for 353 yards, but the Sun Devils turned it over three times, including one on a failed trick play, to lose for the fourth time in five games.
"We were in position to score points and the turnovers hurt us," Arizona State coach Herm Edwards said. "You can't do that against a good football team and Stanford is a good football team, no doubt about that."
Neither offense could gain much traction in the first half.
Arizona State had a good drive going late, but failed on a trick play when receiver N'Keal Harry's pass off a reverse was intercepted at Stanford's 11.
The Cardinal appeared to have a touchdown when Cameron Scarlett turned a screen pass into a 59-yard score, but it was called back on a holding penalty.
Jet Toner hit his second field goal, from 31 yards, on the final play of the half to put Stanford up 6-3.
"The three points we gave them, the interception in the red zone, you take those plays back, get a field goal or a touchdown, it's a different ball game," Wilkins said.
Arizona State opened the second half with Brandon Ruiz's second field goal.
Stanford opened by dominating the Sun Devils on a pair of long scoring drives to take control.
Costello hit JJ Arcega-Whiteside on a 28-yard touchdown pass on the first drive, and Scarlett scored on a 1-yard dive to put the Cardinal up 20-6.
"We ran the ball against a team that's really difficult to run the ball against, threw the ball when we needed to, made some big plays," Shaw said.
Stanford still has control of the Pac-12 North with an impressive road victory that prevented the Cardinal's first three-game losing streak in eight seasons under coach Shaw.
The Sun Devils now have win three of their final six to become bowl eligible in their first season under Edwards. It won't be easy, with road games against USC, Oregon and Arizona still left.
Stanford running back Bryce Love returned after missing the Utah game with a left ankle injury. He was not fully healthy against the Sun Devils, but did show bursts of explosiveness before Shaw opted to take him out in the second half.
Love finished with 21 yards on 11 carries.
"Once he got warm, got loose, there were a couple of 4-, 5-yard runs that were really impressive," Shaw said. "He explosiveness in short areas was impressive."
Stanford hosts Washington State next Saturday.
Arizona State plays at Southern California next Saturday.
More AP college football: https://apnews.com/tag/Collegefootball and https://twitter.com/AP-Top25