STILLWATER, Okla. (AP) Spencer Sanders waited a long time for this moment.

Oklahoma State's sophomore quarterback passed for 235 yards and ran for 71 and a touchdown in his return from injury, and the sixth-ranked Cowboys defeated No. 17 Iowa State 24-21 on Saturday.

Sanders suffered a right hand injury late last season and missed most of the action in the final three games. This season, he injured his right ankle in the season opener against Tulsa and hadn't played since.

His return had its rough spots - he threw two interceptions. But he made enough plays - including a 34-yard touchdown pass to Jelani Woods - to get his team through.

''I was really frustrated with myself for getting hurt, so I'm really happy that I'm back,'' he said. ''A little frustrated with myself with the two turnovers today, but I'm going to let it go.''

Sanders said he was careful, but aggressive as a runner. He had 15 carries, taking away some of Iowa State's focus away from star running back Chuba Hubbard.

''I ran hard, but I never let anybody one-on-one just take me down,'' Sanders said. ''I was always laying my body to the side knowing I was going to get tackled - just going down rather than taking that extra hit.''

Hubbard ran for 139 yards and a touchdown for Oklahoma State (4-0, 3-0 Big 12). With the win, the Cowboys joined Kansas State as the only remaining undefeated teams in conference play.

The Cyclones (3-2, 3-1) vaulted onto the national radar by beating Oklahoma earlier in the month and were seeking their first ever 4-0 start in league play. Iowa State's Breece Hall, who was second nationally in yards rushing per game, ran for a career-high 185 yards. But the Cyclones were a few plays short and made a few too many mistakes.

''We definitely left some out there,'' Hall said. ''We got down to the red zone a couple times and didn't convert and get any points and took some unnecessary penalties and had miscommunication. It was real frustrating.''

With Oklahoma State leading 14-7 late in the second quarter, Iowa State drove deep into Oklahoma State territory but had to settle for a field goal attempt. Connor Assalley's 33-yard kick bounced off the right upright with 1:22 left in the first half. It was his second missed field goal of the first half, and Oklahoma State took its seven-point lead into the break.

Hall broke away for a 66-yard touchdown run in the third quarter, and the Cyclones tied the game at 14.

Sanders' 14-yard touchdown run on the next possession gave the Cowboys the lead again, and Alex Hale's 31-yard field goal pushed the lead to 24-14.

Brock Purdy threw a 20-yard touchdown pass to Xavier Hutchinson with 49 seconds remaining to trim Oklahoma State's lead to 24-21. Oklahoma State recovered Iowa State's onside kick, and the Cowboys ran out the clock.

''We'll tip our hat to Oklahoma State,'' Iowa State coach Matt Campbell said. ''Hard-fought football game. They made some plays when they had the opportunity to make them. We had opportunities to make plays and just didn't.''

THE TAKEAWAY

Iowa State: The Cyclones entered the game wanting to jump from a team that pulls an occasional upset to league leader that others chase. The passing game struggled, and outside of two long runs by Hall, so did the running game.

Oklahoma State: The Cowboys learned that they can lean on their defense against a quality Big 12 opponent. Purdy passed for just 162 yards. The Cowboys were ranked second nationally in scoring defense and No. 6 in total defense, and they lived up to it against a Top 25 team.

NO REPEAT

The last time Purdy played Oklahoma State in Stillwater, he passed for 318 yards and four touchdowns and ran for 84 yards and another score in the Cyclones' 48-42 win two years ago.

Jim Knowles was Oklahoma State's defensive coordinator in both games. Gundy said the game plan was better this year.

''Overall, I thought our plan was way better and was executed better than it was when Brock Purdy was here as a freshman,'' Gundy said. ''I thought Jim Knowles and them rallied today, had a good plan and were able to keep us in the game and force some three-and-outs.''

MOMENTUM SWING

Hall took off for a 70-yard run in the first quarter, but Assalley eventually missed a 48-yard field goal. It took just three plays for Oklahoma State to score - Sanders found Woods for the touchdown pass that tied the game at seven.

''I thought it was huge,'' Campbell said. ''That was, if you talk about a difference in the game, that's one of those moments where it drastically alters the game.''

QUOTABLE

Gundy on the defense: ''We haven't made plays (in past years) like the ones we made today. ... They're gaining some confidence. Confidence is a powerful thing in life, particularly in sports. Every day, they're getting a little more confident.''

UP NEXT

Iowa State visits Kansas on Saturday.

Oklahoma State hosts Texas on Saturday.

---

More AP college football: https://apnews.com/Collegefootball and https://twitter.com/AP-Top25

---

Follow Cliff Brunt on Twitter: www.twitter.com/CliffBruntAP.

Copyright 2024 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.