PORTLAND, Ore. — Jordan Pope and Matas Vokietaitis each scored 17 points, Camden Heide hit a game-sealing 3-pointer and Texas became the first team in five years to go from the NCAA Tournament’s First Four to the Sweet 16, beating Gonzaga, 74-68, on Saturday.

First-year coach Sean Miller’s 11th-seeded Longhorns (21-14), who lost five of six entering the tournament and looked underwhelming in their First Four win over N.C. State, will face either No. 2 seed Purdue or No. 7 seed Miami on Thursday in the West Region semifinals San Jose, Calif.

The last First Four team to reach the Sweet 16 was UCLA, which made it all the way to the Final Four in 2021.

“Our ride has never been easy, but we fought the good fight the whole way and we did it again,” Miller said.

Graham Ike led third-seeded Gonzaga (31-4) with 25 points, but the Bulldogs struggled to generate much secondary scoring.

Coach Mark Few’s Zags bowed out in the second round for the second straight year after reaching the Sweet 16 in nine consecutive tournaments, a run that included two losses in the national title game.

After Ike’s dunk got the Zags within 69-68 with 40 seconds left, Miller called timeout and drew up a play that got Heide free in the corner. The 6-foot-7 junior, who played just 13 minutes, confidently knocked down his only basket of the game, giving Texas a four-point lead with 14.7 seconds left. Vokietaitis capped the scoring with a breakaway layup.

Gonzaga, a 6 1/2-point favorite according to BetMGM Sportsbook, led by eight points in the first half, but Texas led 35-33 at halftime and made it tough for the Zags to score down the stretch.

Dailyn Swain dunked to give the Longhorns a 57-54 lead with 7:33 left.

Pope’s 3-pointer with 5:28 remaining put Texas up 62-56. Ike’s layup closed Gonzaga within 66-64, but Pope answered with a 3 to put Texas ahead 69-64.

It’s the 15th Sweet 16 appearance and first since 2022-23 for Texas, and the ninth for Miller, who got to five regional semifinals with Arizona and three with Xavier.

The Bulldogs were making their 27th appearance in the tournament, and they played in front of a friendly crowd that chanted “Let’s Go Zags!” after David Fogle’s jumper made it 28-20 in the first half.

Gonzaga beat No. 14 seed Kennesaw State on Thursday, but this result could lead to some angst in Spokane before the Zags join the reconstituted Pac-12 ahead of next season.

Texas, meanwhile, rode the momentum after knocking off likely NBA lottery pick AJ Dybantsa and BYU in the first round. The Longhorns became the first-double digit seed in this largely chalky tournament to get through the first two rounds.