MEXICO CITY — Deron Williams had 23 points and 15 assists, and the Dallas Mavericks defeated the Phoenix Suns 113-108 on Thursday night in the fourth NBA regular-season game played in Mexico.

Williams shot 9 for 15 from the field in a matchup of struggling teams. Harrison Barnes added 22 points and Dirk Nowitzki scored 18 for the Mavericks, who broke a three-game losing streak.

Devin Booker scored 29 of his 39 points in the fourth quarter for the Suns. Tyson Chandler had 14 points and 19 rebounds against his former team.

Dallas and Phoenix are tied for the worst record in the Western Conference at 12-27.

The game was the first of two that the Suns will play south of the border. Mexico is hosting two games in one season for the first time in NBA history.

The previous regular-season game in Mexico took place in 2015, when Boston faced Sacramento.

Phoenix took a 59-57 lead at halftime, but Williams hit a couple of 3-pointers and a jumper in a 17-4 run to give the Mavericks a 76-63 lead with seven minutes left in the third quarter.

The Suns got within four after a 3 by Booker with 13 seconds to play in the game, but Dorian Finney-Smith made two free throws to seal it for Dallas.

Seth Curry, in his seventh start of the season, scored nine points in the first quarter for the Mavericks, who took a 27-19 lead. Phoenix rallied and trailed just 32-29 after the first 12 minutes.

In the second quarter, Leandro Barbosa had back-to-back baskets and the Suns took the lead, but Dallas tied it with a shot from Barnes. Marquese Chriss got a layup with 19 seconds to play, sending Phoenix into the break with the lead.

UP NEXT

Suns: Play the San Antonio Spurs on Saturday in Mexico City.

Mavericks: Host the Minnesota Timberwolves on Sunday.