LOS ANGELES (AP) — LeBron James walked into Staples Center on Halloween dressed as Jason from the "Friday the 13th" movies. Five hours later, he saved the Los Angeles Lakers from a horrifying ending.

The four-time MVP scored 29 points and made the game-winning free throw with 2.1 seconds left Wednesday night as the Lakers held on for a 114-113 win over the Dallas Mavericks.

"I don't like the way we closed out the game, but for the majority of the game we played well," James said.

Los Angeles led nearly throughout and was up 111-98 with 3:42 to go before the Mavericks went on a 15-2 run to pull even. Luka Doncic tied it at 113 with 7.2 seconds remaining on a jumper from the corner, but on the next trip down the floor James was fouled by Wesley Mathews while shooting a jump shot.

James missed the first free throw but made the second. J.J. Barea missed a 3-pointer for Dallas as time expired, and the Lakers (3-5) stopped a two-game skid.

"NBA games are never over and you have to play the game a certain way," Lakers coach Luke Walton said. "If you mess with the game, the game will mess with you and I thought we did that a little bit. Hopefully we can learn the same lesson even if it was a win."

JaVale McGee added 16 points and 15 rebounds, Kyle Kuzma scored 18 and Brandon Ingram had 17 for the Lakers.

Matthews led Dallas with 21 points and Harrison Barnes scored 19. The Mavericks (2-6) have lost five straight.

"I love the fight. Our first quarter was very disappointing but we battled back," coach Rick Carlisle said. "We were able to get stops in the fourth quarter and we were getting some momentum on offense."

The Lakers scored the first eight points and led by 18 in the first quarter as they went 15 of 23 from the field and made six 3-pointers.

Dallas trimmed the margin to 66-59 by halftime. Matthews' driving bank shot pulled the Mavericks to 70-64 before the Lakers went on a 17-4 run — which included 10 points by James — to open their largest lead at 87-68 with 4:40 remaining in the third.

The closest the Mavericks got in the first eight minutes of the fourth was 98-90 with 8:12 left.

ROAD WOES

The Mavericks, who dropped to 0-5 on the road, are one of seven teams in the NBA without a win away from home. They have lost 10 straight road games dating back to last season.

TOUGH START, BETTER FINISH

Doncic, the second pick in the 2018 draft, said before the game that he grew up idolizing James. The teenager from Slovenia, who scored 31 points Monday night at San Antonio and is averaging 20.4 points per game, might have been in awe a bit during his first game against James as he missed his first six shots.

Doncic was able to shake off the slow start, though, as he made his final five shots from the field and finished with 14 points. James gave Doncic his jersey after the game.

TALE OF TWO HALVES

The Lakers held the Mavericks to 37 percent from the floor in the first and third quarters (17 of 46), but Dallas shot 65 percent (26 of 40) in the second and fourth.

"The first and third quarters defensively we were pretty good and then we had two awful quarters. It is just about getting better with those things," Walton said.

TIP-INS

Mavericks: DeAndre Jordan had 12 rebounds and 10 points. ... Barea (15 points) and Dwight Powell (12) came off the bench to score in double figures. ... The Mavericks were 14 of 19 from the field in the second quarter. ... G Devin Harris (left hamstring strain) missed his seventh straight game.

Lakers: Have won three straight against the Mavericks. ... McGee also had five blocked shots, making it his first game with at least 15 points, 15 rebounds and five blocks since Jan. 14, 2012, with Washington. The last Lakers player to accomplish that was Pau Gasol on Jan. 20, 2014, at Chicago. ... Kuzma scored 11 points in the first quarter. ... The 38 points were a season high for a first quarter. ... F Michael Beasley missed his second straight game due to personal reasons.

UP NEXT

Mavericks: Host New York on Friday.

Lakers: At Portland on Saturday.

More From 1460 ESPN