It was the third win in four games for the Mavericks, who allowed all of a 15-point, fourth-quarter lead to disappear.
Detroit took a 97-96 advantage with 2:29 to play on a 3-pointer by Khris Middleton, but Nowitzki then made his back-to-back baskets to put the Mavericks back in front.
Two free throws by Darren Collision gave Dallas a three-point lead with 3.8 seconds and the Mavericks survived when Charlie Villanueva misfired on a 3-point attempt at the buzzer.
Detroit was led by 21 points from Brandon Knight in what was the Pistons' seventh loss in eight games.
Notable deaths of 2014 [PHOTOS]
UPI horse racing weekend preview