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
Ohio State 2019 spring football preview: A new era for the Buckeyes
Ryan Day takes over for Urban Meyer, with Georgia QB transfer Justin Fields getting a chance to lead the offense.
Nine simple steps to go from obscure punter to viral sensation
Living in a villa in Bali, owning a tattoo parlor and working construction in Australia. Here's how Miami's Louis Hedley became a signing-day star.
Ex-Colorado, Seahawks player T.J. Cunningham fatally shot in dispute
Former Colorado and Seahawks player Anthony "T.J." Cunningham died Monday after he was fatally shot in a dispute over a parking space.
Former Virginia Tech QB Josh Jackson transferring to Maryland
Former Virginia Tech quarterback Josh Jackson announced Monday night that he is transferring to Maryland, where he is expected to be a frontrunner in the competition for the starting quarterback job.
Alabama spring football preview: Tide look to regroup off title loss
The expectations -- winning a national title -- remain the same in Tuscaloosa, despite serious player and coaching turnover. What's next for the Tide this spring?
Murray: 'End of the day, I'm a football player'
Kyler Murray is excited about his decision to pursue football and the upcoming combine.