MORGANTOWN, W.Va. (AP) Sam Ehlinger helped Texas get that elusive win over a ranked opponent.

Ehlinger threw two touchdown passes and the Longhorns became bowl eligible under first-year coach Tom Herman with a 28-14 win over No. 24 West Virginia on Saturday in a game in which the Mountaineers lost quarterback Will Grier to injury.

Texas (6-5, 5-3 Big 12) qualified for a bowl for the first time since 2014, which was former coach Charlie Strong's first season. The Longhorns also beat a ranked opponent for the first time in five tries this season.

''We know we've got one left, but this was a big one,'' Herman said. ''This was a big hurdle - to get another road conference win, to beat a top 25 team, and make sure that our seniors are bowl eligible. These guys are ecstatic.''

Texas didn't give up a sack and the running game had its best effort in more than two months. The Longhorns entered with 13 touchdown passes, and Ehlinger got two in the second quarter.

''Coach kept saying just keep swinging and keep swinging, it's going to pay off,'' Ehlinger said. ''I think we did an excellent job of that as a team - just keep moving forward.''

Ehlinger's 50-yard pass to Reggie Hemphill set up Ehlinger's 4-yard TD toss to Kendall Moore. Ehlinger did most of the work on the Longhorns' next drive. He went from sideline to sideline for a 17-yard gain on third down, ran 23 yards after catching a pass from wide receiver Jerrod Heard, then found Chris Warren for a 23-yard score just before halftime for a 14-0 lead.

''He's tough. He's a competitor,'' Herman said of Ehlinger. ''He gives us a dimension in the run game - 7.6 yards per carry. That's a pretty good day at the office. We knew it would be difficult throwing the football against this defense.''

Grier left the game in the first quarter with an injured throwing hand when he landed awkwardly as he dove for the end-zone pylon on a run. The middle finger of his right hand was bent backward and he did not return.

West Virginia coach Dana Holgorsen said Grier had a broken finger.

''Injuries are a part of college football,'' Holgorsen said. ''When that happens, guys need to step up. We've talked a lot about that. Guys need to step up and go in there and they need to play.''

Backup Chris Chugunov couldn't get much going. He threw a 12-yard scoring pass to Ka'Raun White early in the fourth quarter to pull West Virginia within 21-14. But the Mountaineers (7-4, 5-3) didn't score again.

THE TAKEAWAY

Texas: Ehlinger looked comfortable mixing runs and passes on a damp day. He finished 12 of 19 for 136 yards and ran nine times for 68 yards. Shane Buechele started for the Longhorns but played only two series in the first quarter.

West Virginia: The Mountaineers struggled to get first downs without Grier. Chugunov, a sophomore who played in two previous games this season, finished 14 of 26 for 189 yards. West Virginia was held to a season-low 295 yards of offense.

RUNNING FINE

With left tackle Connor Williams returning from a seven-game layoff because of a knee injury, Texas piled up 233 rushing yards, the most since it gained 406 against San Jose State in the second week of the season. Freshman Daniel Young had a season-high 85 yards, including a 1-yard TD run.

ROBINSON'S RETURN

Midway through the third quarter, Ehlinger was hit by linebacker Dylan Tonkery as he threw near the West Virginia goal line. Freshman safety Kenny Robinson grabbed the floater and returned it 94 yards for a touchdown. It was Robinson's second pick six this season.

HAGER EJECTED

Texas linebacker Breckyn Hager was ejected for targeting on a fourth-quarter hit on Chugunov. Hager flashed a ''Hook `Em Horns'' sign to the booing crowd as he was escorted off the field. Earlier in the week, he was asked what made Morgantown a tough venue for opponents. Recalling a 2015 trip, Hager told reporters, ''It's a bunch of hillbillies drinking moonshine.''

UP NEXT

Texas finishes the regular season at home next Friday against Texas Tech.

West Virginia plays at No. 10 Oklahoma next Saturday.

---

More AP college football: http://collegefootball.ap.org and http://www.twitter.com/AP-Top25

Copyright 2017 by AP. Any commercial use or distribution without the express written consent of AP is strictly prohibited.