AUSTIN, Texas (AP) -- Texas running back Johnathan Gray rushed for 141 yards and two touchdowns, quarterback David Ash threw a 63-yard touchdown pass and Texas beat Kansas State 31-21 Saturday night in the Big 12 opener for both teams at Royal-Texas Memorial Stadium.
Gray became Texas' first 100-yard rusher on the season and Texas' defense, pushed around in two consecutive losses, put up a solid and energetic performance, forcing three critical second-half turnovers.
Ash, who missed the previous game with concussion-like symptoms, passed for 166 yards in the first half but missed the second with a new head injury. Senior Case McCoy took over, leading two touchdown drives.
Running back John Hubert scored two touchdowns and wide receiver Tyler Lockett had 13 catches for a school-record 237 yards for Kansas State (2-2, 0-1 Big 12).
The Longhorns snapped a five-game losing streak in the series, beating the Wildcats for the first time since 2003.
Gray's first touchdown in the second quarter came after he made two dazzling cuts on a 21-yard run. His second put Texas up 24-7 in the third. Malcolm Brown ran for Texas' last touchdown after the Wildcats had pulled within 10 points early in the fourth quarter.
Texas came in as a team desperate to turn around it season. After consecutive losses, Brown urged his team to focus on the Big 12 and trying to win the league crown. The Longhorns, most notably the defense, responded with their most complete game of the season against the defending Big 12 champs.
The defense, which played so poorly in the two losses, gave up a huge night receiving to Lockett, but forced the three turnovers that swung momentum early in the second half and preserved the win late.
Ash, who had been cleared to play Friday night, showed no effects of the previous head injury early in the game. But he took several big hits, both on runs and when standing in the pocket, before floating a perfectly-thrown pass to Kendall Sanders for Texas' first touchdown.
Texas went up 17-0 after Ash converted a fourth down with a short pass to Jaxon Shipley to set up Gray's first touchdown. Kansas State responded with its first drive across midfield and Hubert spun through two tacklers on a 15-yard touchdown run with 1 minute left in the half.
Ash was removed at the game at halftime to be evaluated for a head injury and didn't return, putting the game and the job of managing the lead in McCoy's hands. Kansas State fumbled on the first possession of the third quarter and McCoy handed the ball to Gray seven times in eight plays on a 56-yard drive to a touchdown and a 24-7 lead.
Hubert's second touchdown pulled Kansas State within 24-14 early in the fourth. Kansas State had pulled within 10 and was driving for a touchdown when Waters, who ran for a touchdown and passed for 275 yards, fumbled on the Texas 6 with 2:03 left to play.
The Wildcats had one last chance when Tramaine Thompson returned a punt 40 yards inside the Texas 15, but Waters was sacked twice and fumbled with 17 seconds left.