DALLAS (AP) — Luka Doncic scored 21 points, including the tiebreaking free throws with 30 seconds left, and the Dallas Mavericks ended a six-game losing streak with a 122-119 victory against the New Orleans Pelicans on Wednesday night.

The 19-year-old rookie made 11 of 12 free throws, including the last three points of the game in the final half-minute. He missed one of two after rebounding a miss on a 3-pointer from Anthony Davis, who had 32 points and 18 rebounds in the fifth consecutive loss for the Pelicans.

Davis missed another 3 with a chance to tie in the final seconds, and Doncic got the rebound again to finish one rebound shy of a triple-double. The Slovenian had 10 assists in the first of two straight games between these teams.

DeAndre Jordan had 20 points on 7-of-7 shooting and 12 rebounds for his 22nd double-double.

The backup guard duo of J.J. Barea and Devin Harris carried the Mavericks through most of the fourth quarter. Barea had 11 of his 18 in the final quarter, including 3-of-3 shooting on 3-pointers, and Harris scored 10 of his 16 in the fourth.

Jrue Holiday scored 25 points, and Julius Randle had 23 points, including 11-of-13 shooting on free throws, against his hometown team.

The Mavericks ended a streak of five straight games of allowing at least 120 points while ending a losing skid that had matched their season high.

Maxi Kleber had a career-high six blocks as the Mavericks finished with a season-high 13. Kleber had 10 points. Harrison Barnes scored 16.

SEASON HIGH FOR DIRK

Dirk Nowitzki scored a season-high seven points while playing in the second half for the second time in his six games. The 40-year-old hit a 3 late in the third quarter to top his previous high of three points.

Nowitzki is in his 21st season with one team, an NBA record. The 13-time All-Star missed the first 26 games with a longer-than-expected recovery from left ankle surgery in April. He became the sixth NBA player with 900 career wins, after the Mavericks lost his first five games.

RARE DOUBLE-DOUBLE

Teams playing two games in a row against each other, as the Mavericks and Pelicans will do, isn’t that unusual. Consecutive sets of such games are a little strange, though. Dallas will do that with two straight against Oklahoma City on back-to-back nights Sunday and Monday.

TIP-INS

Pelicans: The other double-figure scorer was Frank Jackson with 10. ... Tim Frazier had nine points and seven assists.

Mavericks: Nowitzki passed Karl Malone for fourth on the career list of games played at 1,477. Nowitzki has a chance to catch John Stockton (1,504) for third. Malone and Stockton spent 18 seasons together in Utah.

UP NEXT

The teams play again Friday in New Orleans.