DALLAS (AP) — Devin Harris faked once, twice, three times before making a 3-pointer in a big fourth quarter for the Dallas Mavericks.

There was no such hesitation from 19-year-old Luka Doncic on the decisive play in the final minute.

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

The rookie sensation drove down the right wing past Julius Randle, and after shaking off his anger over not getting the continuation call when he made the layup, Doncic connected on both free throws for a 121-119 lead.

“I mean, he’s a rookie. He’s going to have to work for some of those calls,” said center DeAndre Jordan, who had 20 points and 12 rebounds. “He’s a big, strong body down there who doesn’t shy away from the contact.”

Doncic did get to the line plenty. The Slovenian guard made his first 11 before missing his final free throw 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. He had 10 assists in the first of two straight games between these teams.

All five losses on the New Orleans skid have been by single digits.

“The same stuff. We can’t close out a game,” Davis said after his 23rd double-double. “I thought we were fighting on the road. Things just weren’t going our way.”

Harris and fellow backup guard J.J. Barea carried the Mavericks through most of the fourth quarter.

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

“Every little thing that happened positively for us has to happen for us to win that game,” coach Rick Carlisle said. “When you have lost six and are desperate to get a win, this is the kind of win you have to have.”

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

TIP-INS

Pelicans: The other double-figure scorer was Frank Jackson with 10. ... Tim Frazier had nine points and seven assists. ... Davis had his 12th 30-point game of the season.

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. ... Jordan was 7 of 7 from the field in his fifth straight double-double and 22nd of the season. ... Harrison Barnes scored 16 points and Maxi Kleber had 10. ... The Mavericks are 14-3 at home with wins in 12 of their past 13 games.

BLOCK PARTY

Kleber had a career-high six blocks as the Mavericks finished with a season-high 13 less than a week after their first game this season with zero. The LA Clippers shot 57 percent in that 125-121 win over Dallas.

ERRANT STEP

The Pelicans had just 10 turnovers, but two were for stepping out of bounds in the first half, when they had their biggest lead of nine points. “That’s elementary school,” coach Alvin Gentry said. “You can’t step out of bounds when we throw you the ball.”

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.