SAN JOSE, Calif. — Jordan Mathews hit the go-ahead 3-pointer with less than a minute to play, and top-seeded Gonzaga survived a rough shooting night for both teams to beat No. 4 seed West Virginia 61-58 on Thursday night to advance to the West Region final.

On a night that featured 51 fouls and only 34 made baskets, Mathews delivered the big shot that sent the Bulldogs (35-1) to the third Elite Eight in school history.

It didn’t come easily. West Virginia (29-8) had three shots to tie the game, but Tarik Phillip missed a shot from the lane and Jevon Carter missed two 3-pointers after Silas Melson made one foul shot. The Mountaineers rebound both misses, but couldn’t get off another shot before the buzzer.

Despite shooting 26.7 percent for the game, West Virginia stayed close and took a 58-55 lead on a 3-pointer by Carter with 1:47 to play. Nigel Williams-Goss answered for Gonzaga with two free throws.

After West Virginia’s Daxter Miles Jr. missed two foul shots and Nathan Adrian was blocked by Josh Perkins on the putback, Williams-Goss found Mathews in the corner for the open 3-pointer that proved to be the game-winner.

Mathews, Przemek Karnowski and Johnathan Williams all had 13 points to lead the Bulldogs.