Oklahoma State finally broke through against its greatest nemesis.

Spencer Sanders threw for a touchdown and ran for another and No. 7 Oklahoma State beat No. 10 Oklahoma 37-33 on Saturday night to keep alive its College Football Playoff chances and stop the Sooners' streak of Big 12 titles at six.

Oklahoma State (11-1, 8-1, No. 7 CFP) snapped a six-game losing streak to Oklahoma. The Cowboys will play No. 9 Baylor next Saturday for the Big 12 championship. The Cowboys have a shot at their first Big 12 title since 2011.

"I told them we couldn’t be more proud of them for what they’ve accomplished," Oklahoma State coach Mike Gundy said. "That’s the good news. Next thing is, we need them all back here tomorrow afternoon. We’re in a one-week playoff again."

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Oklahoma (10-2, 7-2, No. 10 CFP) got the ball one last time at its 20-yard line with 54 seconds remaining and no timeouts. Caleb Williams scrambled and ran 56 yards to put the Sooners in scoring range.

"I wasn’t sure we were going to be able to catch him and get him down," Gundy said. "I’ve seen him do that on TV two, three, four times this year. Nobody ever catches him. He scores."

Oklahoma State's Collin Oliver sacked Williams on fourth down at the Oklahoma State 32 with eight seconds remaining, setting off a wild celebration. Fans clad in orange and black poured onto the field to celebrate Gundy's third win in 17 tries against the Sooners. Songs such as "Friends in Low Places" by Garth Brooks and "All I Do Is Win" by DJ Khaled blared over the sound system.

It wasn't easy for the Cowboys. Though Oklahoma State entered the game ranked second nationally in scoring defense and third in total defense, Williams threw three touchdown passes in the first half.

Oklahoma State linebacker Malcolm Rodriguez, who finished with 11 tackles and two sacks, said the Cowboys remained confident after the shaky start. Williams connected on just 6 of 18 passes for 48 yards in the second half.

"We knew we’re the best defense, so we just knew we’ve just got to go out there and punch and just keep fighting, man," Rodriguez said. "Just do our thing, relax and just be us."

Oklahoma State already had clinched a spot in the Big 12 title game, but the stakes remained high. With Baylor's victory over Texas Tech earlier Saturday, Oklahoma needed a win to reach the conference championship game. Oklahoma State took advantage of the opportunity to eliminate its rival.

For Oklahoma, the loss provided perspective.

"I think for everybody, what this does is it makes you appreciate it," Oklahoma coach Lincoln Riley said. "What this program’s been able to do here over the last seven years is pretty amazing, and it makes you appreciate how hard winning is, how hard winning championships are, how hard winning against good football teams on the road — how hard that is."

The game turned when Oklahoma’s Eric Gray muffed a punt and Oklahoma State recovered at the Oklahoma 5. Jaylen Warren then punched it in from the 1 to give Oklahoma State a 37-33 lead with 8:54 remaining.

Tay Martin had a 30-yard touchdown catch and a 4-yard touchdown run in the first quarter to help Oklahoma State take a 14-7 lead.

Oklahoma tied it when Williams, backpedaling and under pressure, found Austin Stogner for a 29-yard touchdown pass to tie it. Brennan Presley immediately responded with a 100-yard kickoff return for a touchdown that put the Cowboys back in front.

Late in the second quarter, Oklahoma's Woodi Washington intercepted Sanders' pass and returned it to the Oklahoma State 14. Williams connected with Brayden Willis for a 10-yard score, and the extra point tied it at 24.

Oklahoma opened the second-half scoring in an odd way. Oklahoma's Perrion Winfrey hit Oklahoma State's Dominic Richardson, the ball came loose, and Oklahoma State recovered in the end zone for a safety.

Oklahoma struck again after forcing a three-and-out. Presley muffed the punt, and Justin Broiles recovered in the end zone to give the Sooners a 33-24 lead.

Sanders went 37 yards for a touchdown on an option keep, and Oklahoma State cut Oklahoma's lead to 33-31 with 13:52 remaining.

The Sooners couldn't hold on.

"We just have to keep our heads up," Washington, who intercepted two passes, said. "Of course, we’re going to be sad because we lost the game. We have one game ahead of us. We just have to go out and keep fighting."

THE TAKEAWAY

Oklahoma: The Sooners' offense did not score against Oklahoma State's heralded defense in the second half. Oklahoma's only points after halftime were on the safety and Broiles' fumble recovery.

Oklahoma State: The Cowboys did just enough to get through. They made uncharacteristic mistakes, but got a gritty performance from Sanders, who passed for 214 yards and ran for 93.

"Overall, his decision making, his ability to keep his composure and find his way through it around the pass rush and make plays was really good," Gundy said.

QUOTABLE

Riley, addressing rumors that he will leave to coach at LSU: "I’m not going to be the next coach at LSU. Next question."

BIG NUMBERS

Oklahoma running back Kennedy Brooks became just the fourth Sooner to post three seasons with at least 1,000 yards rushing. He joined De’Mond Parker, Adrian Peterson and Samaje Perine. He also moved into the top 10 in career yards rushing at Oklahoma. He knocked Greg Pruitt out of the top 10 and now has 3,178 yards in his career. He has 464 yards rushing in three career games against Oklahoma State.

UP NEXT:

Oklahoma: Bowl game.

Oklahoma State: Will play No. 9 Baylor in the Big 12 title game.