It was just an exhibition game, but Friday night’s matchup between BYU and New Mexico was reminiscent of the days when the two teams battled as Western Athletic Conference and Mountain West Conference foes.

Cougar guard TJ Haws drilled three free throws after being fouled on a 3-point attempt with 36 seconds remaining to help lift BYU to a 79-73 victory at Dreamstyle Arena, also known as The Pit.

The old rivals came together for a charity game that will benefit the victims of Hurricane Harvey in Houston. All proceeds from the game will go to the Hurricane Harvey Relief Fund.

Cougar forward Yoeli Childs scored a team-high 17 points and pulled down 19 rebounds. Haws finished with 14 points while Elijah Bryant chipped in 13 and Luke Worthington added 12.

BYU guard Nick Emery, who is under investigation by the NCAA for possibly receiving improper benefits, scored two points in 18 minutes.

Sam Longwood poured in a game-high 23 points for New Mexico.

The Cougars won despite having 23 turnovers. BYU shot 52 percent from the floor and 24 percent (5 of 21) from 3-point territory.

Guard Jahshire Hardnett, who keyed a late surge for the Cougars, had nine points and zero turnovers.

BYU went through a five-minute field goal drought midway through the second half as UNM took a 47-46 lead. Bryant's 3-pointer put BYU up 60-59 with 6:19 remaining.

In the first half, BYU led by as many as 10 points, 28-18, as the Cougars enjoyed balanced scoring.

But New Mexico rallied, finishing the half on an 18-9 run. The Lobos’ Troy Simons tipped in a missed 3-pointer at the buzzer, but the bucket was waved off because it came after the horn.

BYU led at intermission 37-36.

Childs scored a game-high seven points, and had nine rebounds, at the break.

The Cougars shot 50 percent from the floor in the first half but also had 12 turnovers. Hardnett and Worthington each scored six points in the first half.

BYU hosts Westminster in another exhibition game Wednesday at 7 p.m.