DALLAS — IN the final home game of a legendary career, Dirk Nowitzki gave an exuberant sellout crowd one final show with a season-high 30 points in the Dallas Mavericks’ 120-109 win against the visiting Phoenix Suns on Tuesday.

Nowitzki, 40, announced after the game that he would retire following the Mavericks’ season finale Wednesday at San Antonio.

The 7-footer, who entered the league in the lockout-shortened 1999 season and revolutionized the power forward position, scored 10 points in the opening seven minutes and had 19 points on a season-high 18 shot attempts in the first half to power Dallas to a 68-38 halftime lead.

He secured his season high in points with a straightaway 3-pointer, his fifth of the game, early in the third quarter for 22 points. That was followed by a rare slam dunk that elicited howls from the crowd and a big smile across Nowitzki’s face.

The 14-time All-Star and sixth-leading scorer in NBA history then drained another jumper for 26 points and an 80-49 Dallas lead. He re-entered the game with three minutes left and hit two more buckets to go 11 of 31 from the floor. He finished with eight rebounds, three assists and a block in a season-high 32 minutes.

Suns veteran Jamal Crawford wasn’t going to let Nowitzki totally steal the stage. He put in seven 3-pointers in posting a season-high 51 points — one off his career best — with 26 coming in the fourth quarter, to get the Suns as close as 105-100 with 4:20 to play.

Crawford, 39, became the oldest player ever to score 50-plus points in an NBA game. The old mark was held by Michael Jordan, who was 38 when he scored 51 for the Washington Wizards on Dec. 29, 2001, against the Charlotte Hornets.

According to ESPN, Crawford also became the first player to score 50 points for four different franchises (Chicago Bulls, New York Knicks, Golden State Warriors and now Phoenix).

The Suns closed out a miserable season, finishing 19-63.

A longer-than-expected recovery from ankle surgery kept Nowitzki out until mid-December. From there, he mostly came off the bench for the first time in his career, and averaged 6.6 points in less than 15 minutes a game before Tuesday.

But on this special night, Nowitzki turned back the clock, and so did the crowd as it chanted “M-V-P! M-V-P!” Nowitzki won the league’s regular-season MVP award in 2006-07 and earned NBA Finals MVP in 2011, when he delivered Dallas its lone championship.

The future of the Mavs (33-48), rookie Luka Doncic, also didn’t disappoint, notching his eighth triple-double with 21 points, 11 assists and 16 rebounds. He moved into sole possession of third place for most triple-doubles by a rookie. — Reuters