The Nets messed up their chance at a game-winning attempt, and Jordan Farmar was forced to toss up an off-balance shot that didn't come close to going in at the buzzer.
Nowitzki finished with 23 points on 7-of-24 shooting from the field. It didn't matter because his last shot was the only one that counted.
Tyson Chandler added 19 points for Dallas, which has won five in a row and 19 of 22 against New Jersey.
Brook Lopez had 24 points for New Jersey, which lost its bid for a 13th win, which would have topped last season's total.
New Jersey, which had rallied from a seven-point deficit with 4:44 to go, took its last lead at 85-84 on two free throws by Lopez with 1:32 to go.
After Nowitzki missed a bad-angle 12 footer from the baseline, Devin Harris had a chance to push the lead to three, but he only made one free throw with 51 seconds to go to make it a two-point game.
Nowitzki drove the lane on the Mavericks' next possession and was blocked. Chandler picked up the loose ball and was fouled.
Dallas had made 26-of-27 free throws at that point, but Chandler missed his first attempt and made the second with 35 seconds left to cut the lead to 86-85.
Harris missed a jumper on the next possession after being grazed by Shawn Marion on his shot. The Mavericks called time with 20 seconds to go and set up Nowitzki for his winner.
Down 82-75 with 4:44 to play, the Nets scored eight straight points to take an 83-82 lead on a 3-pointer by Sasha Vujacic with 2:35 to go.
J.J. Barea put Dallas back ahead 84-83 with a 15-footer from the right of the foul line with 1:49 to go.
Dallas only shot 38.5 percent in the opening half but led 48-45 because it hit all 14 free throws.
The Mavericks scored the final 11 points of the half, with eight coming from the free throw line. Nowitzki had seven of the 11, including the only basket, a 3-pointer. Chandler had the other four free throws.
Dallas pushed its lead to 58-51 early in the third quarter, but New Jersey closed with a 17-10 spurt to tie the game heading to the final period.