Champagne might as well have been flowing in the Dallas Mavericks’ locker room after what they were able to accomplish Saturday night.

Down 13 points in the third quarter and in a tense fight for their playoff lives, the Mavs clinched their 13th postseason berth in the past 14 years with a pulsating 101-98 victory over the Phoenix Suns at American Airlines Center.

The Mavericks (49-32) will seek to win 50 games for the first time since the 2010-11 season when they end the regular season Wednesday night in Memphis.

Using every ounce of energy they had, the Mavericks had to rally from a 13-point second-half deficit to beat the Suns, who dropped to 47-33.

Monta Ellis tied his season high with 37 points and Dirk Nowitzki scored 21 of his 23 points in the second half as the Mavericks kept barking at each other on the court during tense moments, and it paid off in the end.

“Everybody really wanted to get this win,” said Ellis, who had 23 of his points after halftime. “It was a total team effort, and we feel happy right now.

“We’re going to the playoffs, and so it’s time for us to get this last one and get ready for whoever we match up with.”

In their matchup with the Suns, the Mavericks didn’t fare too well when they fell behind 69-56 midway through the third period. But Ellis buried three 3-pointers and Nowitzki added a pair of 3-pointers to get the Mavericks within 74-73 late in the third quarter.

As a whole, Ellis and Nowitzki carried the Mavericks on offense.

“The reason we won is because we had one of the best players on the planet in Dirk,” coach Rick Carlisle said. “And because Monta Ellis, at the time we needed him the most, stepped up and played the biggest game of the year.

“And [Ellis] played the whole second half. I couldn’t get him out of the game.”

The game had numerous emotional moments, but it was the Mavericks who overcame 19 turnovers to hold off the Suns.

Ellis had two chances to give the Mavericks a four-point lead with 9.7 seconds left, but he split a pair of free throws, opening the door for the Suns to send the game into overtime with a 3-pointer. But Markieff Morris gave the crowd something else to cheer about when he missed a 3-pointer at the buzzer, and the Mavs breathed a sigh of relief.

“It’s pretty clear we’re not a perfect team,” Carlisle said. “But with our imperfections we’ve got to understand that we really need each other and that kicked in during the second half and that made the difference.”

Backup center Brandan Wright also helped make a difference. He finished with 12 points, 11 rebounds and three blocks.

With the Suns down 100-98, Eric Bledsoe drove to the right side of the lane and tossed up a potential-typing basket with 12.9 seconds left which Wright promptly blocked.