LOS ANGELES — All eyes were on Luka Doncic, anticipating his every move in a Lakers uniform in his first game against his former team, the Dallas Mavericks, on Tuesday night at Crypto.com Arena.

Sections of Lakers fans chanted “Thank you, Nico!” whenever Doncic was at the free-throw line, referencing Nico Harrison, the Mavericks’ president of basketball operations and general manager who led Dallas in trading Doncic to L.A. over three weeks ago.

But on a night Doncic once again struggled with his shot in a Lakers jersey, it was his ability and willingness to step up in other areas, and set up his teammates, that helped the Lakers (35-21) pull out the 107-99 victory over the Mavericks (31-28).

The 25-year-old Slovenian shot just 35.2% (6 of 17) from the field, including making just one of his seven 3-point attempts, but still finished with a triple-double during a game the Mavericks aggressively defended him.

Doncic finished with 19 points, 15 rebounds and 12 assists to go with three steals and a pair of blocked shots.

His final assist to LeBron James (team-high 27 points, 12 rebounds and three assists) on a layup with 32 seconds left sealed the win for the Lakers, their third straight and 15th in their last 19 games going back to Jan. 15.

Austin Reaves had 20 points, five assists and three rebounds while Rui Hachimura added 15 points and six rebounds.

The Lakers struggled against the Mavericks’ aggressive defensive schemes, which featured trapping and double teams Doncic in the post and pick and rolls.

Dallas tied at the game at 91 with a 3-pointer from Naji Marshall with just over six minutes left.

But James took over late, scoring seven of the team’s final 16 points, including a putback dunk off a Doncic missed stepback 15-footer to put the Lakers up 102-96 with 2:25 left.

Dorian Finney-Smith also made crucial plays late: setting a screen that freed Doncic up for a layup to put the Lakers up 94-91; and a putback dunk off a James missed floater to give the Lakers a 98-94 lead.

Kyrie Irving led the Mavericks with a game-high 35 points, seven rebounds, four assists, three steals and two blocked shots.

Klay Thompson added 22 points and eight rebounds for Dallas.