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 Thursday night in San Jose and 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 their 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 rebounded both misses but couldn’t get another shot off 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 with two free throws.

After Daxter Miles Jr. missed two fouls shots and Nathan Adrian was blocked by Josh Perkins on the putback, Williams-Goss found Mathews in the corner for the open 3-pointer.

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

Carter led the Mountaineers with 21 points.

The game was tied at 30 after a first half that was far from an aesthetic masterpiece with 27 fouls and just 16 baskets. The teams combined for 29 percent shooting, including 2-for-16 from 3-point range.

The Bulldogs created some space early in the second when Mathews hit 3s on consecutive trips and added a free throw for a four-point play on the second to make it 41-34. But the Mountaineers fought back and the game stayed tight until the end.

Gonzaga struggled to get into their offense all game. WCC Player of the Year Williams-Goss was held to 10 points on 2-for-10 shooting with five turnovers.