AMES, Iowa — Oklahoma State got the victory it needed, just not the style points.
Backup quarterback J.W. Walsh threw a 7-yard touchdown pass to Jeff Carr with 3:06 left Saturday, giving No. 5 Oklahoma State a 35-31 victory over Iowa State and keeping the unbeaten Cowboys in playoff contention.
Oklahoma State (10-0, 7-0 Big 12) trailed 24-7 and 31-21 before rallying for a victory that might not look impressive but was still critical in jockeying for one of the four spots in the College Football Playoff.
It was the fifth time in as many road games this season that the Cowboys pulled it out after trailing in the second half.
"I'm sure TV loves us," OSU coach Mike Gundy said. "It's a good win by the team. As we all know, coming up here and playing is never really easy."
Walsh drew the Cowboys to 31-28 with a 16-yard touchdown run early in the fourth quarter and OSU drove 84 yards in 11 plays for the winning score after forcing a punt.
Starter Mason Rudolph got Oklahoma State to the Iowa State 7 and Walsh, usually the team's running quarterback, took it from there. He hit Carr with a swing pass on the left side and two blocks sprung the freshman to the end zone.
"You don't win without having some maturity and a relentless football team," Walsh said, "and we've been able to attain those things very well. There was not a doubt in anyone's mind. You could see it in everybody's eyes."
Quarterback Joel Lanning had helped keep Iowa State (3-7, 2-5) ahead for most of the game, running for two touchdowns and passing for another. He and the Cyclones had two chances after Carr's score, but gave up the ball on downs and then turned it over with an interception after getting it back.
The two teams met in a setting similar to 2011, when an unheralded Iowa State team ended No. 2 Oklahoma State's BCS championship hopes with a victory in two overtimes. On a pleasant, late autumn day, the Cowboys survived in this one, though for the longest time, things were looking grim for Gundy's team, mostly because of Lanning.
The sophomore from nearby Ankeny, consistently ran for nice gains on read options and scrambles and did just enough with his passing to keep the Cyclones moving.
He carried 14 times for 130 yards and scored on runs of 24 and 21 yards. The 21-yarder, on which he ran untouched to the end zone after faking a handoff, gave Iowa State a 31-21 lead late in the third quarter and fueled hopes of another upset.
It just wasn't quite enough. One reason was that Oklahoma State controlled the ball with long, time-consuming scoring drives in the second half.
"I remember looking up at the clock and Okie State had one possession in the third quarter and we had one and there was like three minutes left in the quarter," Lanning said. "It was crazy."
Lanning also completed 11 of 22 passes for 162 yards, including a 24-yarder to Allen Lazard for a TD in the first half, when Iowa State scored three touchdowns and kicked a field goal on its first four possessions.
What appeared to be a fourth touchdown was overturned on review and the Cyclones settled for Cole Netten's 21-yard field goal.
Rudolph completed 24 of 36 passes for 327 yards and a touchdown — a 16-yarder to Marcell Ateman, who made a leaping catch in the far left corner of the end zone to tie it at 7-all.
Ateman finished with career highs of eight catches and 132 yards.
"Mason made some great throws and J.W. is a tough kid," Ateman said. "Both are great guys and a times (Iowa State) struggled to stop them."
Joshua Thomas' 1-yard TD run put Iowa State up 24-7 early in the second quarter. Oklahoma State answered with a 16-play, 88-yard drive that Chris Carson ended with a 1-yard run to draw to 24-14 at halftime. Walsh scored from the 1 to cut the lead to 24-21 midway through the third quarter, capping a 14-play, 92-yard march.
Oklahoma State closes the regular season against Big 12 heavyweights Baylor and Oklahoma, so nothing is guaranteed. But for now, the Cowboys are happy to still be in the conversation.