Nowitzki entered the night needing 10 points to pass O'Neal, who finished his career with 28,596 points. Nowitzki passed O'Neal by hitting a midrange jumper over Andrea Bargnani with 9:51 remaining in the second quarter and was mobbed with congratulatory hugs from teammates, coaches and team staffers in a timeout soon thereafter.
"That was a moment I'll never forget the rest of my life," said Nowitzki, who scored 22 points, giving him 28,609 for his career. "It's surreal passing Shaq, all-time great, legend. I was able to compete against him for a long, long time. I was a fan of his in the '90s. Arguably the most dominant big man ever seen in this game. It's sort of weird that I'm up there now with all these legends, but like I always say, I'm really going to enjoy this once my career is over."
Nowitzki posted a simple tweet following this latest milestone.
Nowitzki said it was "more important to get this win" than passing O'Neal. It seemed fitting that he hit the game-winning shot, an up-and-under layup after the Mavs took advantage of a mismatch when Brooklyn swingman Joe Johnson got switched onto Nowitzki on the block.
At 37 years old and in his 18th NBA season, Nowitzki continues to be an All-Star candidate, averaging 17.5 points while shooting 48.3 percent from the floor and 40.4 percent from 3-point range for a team that's in the middle of the Western Conference playoff pack.
"You're talking about a guy who's a generational great player," Mavs coach Rick Carlisle said. "You're talking about a guy who redefined the game, redefined a position. You run out of accolades. It's such a tremendous feat and such a tremendous individual."
The strengths of Nowitzki and O'Neal could not be more different. Nowitzki has hit 1,619 3-pointers, while Shaq hit just a single long ball on 22 attempts. Nowitzki has also shot about 35 percentage points better from the free-throw line -- 87.9 percent to O'Neal's 52.7 -- while Shaq's interior dominance made him much better from the field -- 58.2 percent to Nowitzki's 47.6.
Nowitzki has made 905 more free throws than O'Neal in 3,470 fewer attempts. Thanks to all of those 3-pointers and free throws, Nowitzki has actually made 1,255 fewer field goals than O'Neal.
Wilt Chamberlain is fifth on the all-time scoring list with 31,419 points, which could be within Nowitzki's reach if he opts to play another season after his current contract expires (following the 2016-17 season).
"That sounds pretty good, huh?" Nowitzki said. "That sounds really good. Like I've said, it's a dream come true. I always say when I was 20 years old, I never expected this. I would have said you're absolutely out of your mind if you would have told me this 18 years ago, coming here with a bad haircut and a bad earring."
ESPN Stats and Information contributed to this report.