Nowitzki scored eight of his 13 points in the fourth quarter as the Mavericks snapped a two-game skid with their 10th consecutive victory over the Lakers.
Julius Randle missed a long jumper at the buzzer for the Lakers, who have lost seven straight.
Nowitzki nailed his go-ahead shot while falling toward the Lakers’ bench, where he got a pat on the back from Kobe Bryant, who sat out to rest his sore right shoulder.
J.J. Barea led the Mavericks with 18 points, and Chandler Parsons had 17.
Jordan Clarkson scored 18 points for the Lakers, and Randle had 16.
The injury prevented Bryant from facing Nowitzki for the 50th and final time in the careers of the NBA's top two active scorers. Nowitzki is two months older than the 37-year-old Bryant, and the German 7-footer entered the NBA in 1998, two years after Bryant's debut.
Nowitzki struggled with foul trouble while Bryant watched from the Lakers' bench -- after removing Larry Nance Jr. from his seat and telling the rookie to grab some floor.
The teams traded the lead throughout an exciting fourth quarter, with veteran Dallas struggling to put away the Lakers' young lineup.
Nowitzki put the Mavericks ahead on a jumper with 2:31 to play, but Clarkson tied it moments later. Both teams missed open shots before Lou Williams was called for an offensive foul with 13.5 seconds left, setting the stage for Nowitzki's latest big shot against the Lakers.
Bryant had harsh words of motivation for his young teammates after their most recent loss in Portland, but decided he shouldn't play through the re-occurring pain in his shoulder. "When he complains about something and says something is sore, you know it's sore and he's not joking around," Lakers coach Byron Scott said. "We'll just rest it and see how he feels." Bryant's strained Achilles tendon felt fine, the guard said.
Nick Young hit his first 3-pointer since Jan. 3 in the second quarter. The veteran guard was 0 for 9 in six games since then, and he didn't play in six games during that stretch.
Mavericks: Zaza Pachulia sat out to rest his injured Achilles tendon. Salah Mejri started in his place and scored nine points. ... Devin Harris also sat out to rest his injured left foot. The guard got an injection in the foot earlier in the day. ... Nowitzki got a technical foul in the final seconds of the first half for protesting a call.
Lakers: Nance returned from a four-game absence with a sore knee, but went scoreless in 23 minutes. ... Brandon Bass played despite a foot injury, scoring five points.
Mavericks: At the Warriors on Wednesday.
Lakers: Host the Bulls on Thursday.