De'Aaron Fox scored 23 points, including a crucial basket to help Sacramento stay in front in the final minute, and the Kings beat the Dallas Mavericks 125-121 on Tuesday night.

With the Kings leading by two, Fox drove and missed a layup but got his own rebound and tried again. The second attempt went in for a 121-117 lead with 26 seconds remaining as Sacramento finished 3-0 against Mavericks, sweeping the season series for the first time since 1997-98.

Dallas rookie sensation Luka Doncic tied Magic Johnson with his seventh triple-double in his first season, getting 28 points, 12 rebounds and 12 assists. It's the third-most triple-doubles by a rookie. Dwight Powell had 21 points and a season-high 13 rebounds.

Sacramento Kings forward Harrison Barnes, center, looks up at the video board from the bench during a time out as the Dallas Mavericks play a video tribute to Barnes in the first half of an NBA basketball game in Dallas, Tuesday, March 26, 2019. Barnes made his first appearance in Dallas since being traded away by the team earlier this season. (AP PhotoTony Gutierrez)

Sacramento Kings forward Harrison Barnes, center, looks up at the video board from the bench during a time out as the Dallas Mavericks play a video tribute to Barnes in the first half of an NBA basketball game in Dallas, Tuesday, March 26, 2019. Barnes made his first appearance in Dallas since being traded away by the team earlier this season. (AP PhotoTony Gutierrez)

Harrison Barnes scored 18 points in his first appearance in Dallas since the Mavericks traded him to Sacramento while he was playing in a game Feb. 6. Buddy Hield scored 15 of his 17 points in the second half, including a 3-pointer to put the Kings ahead for good with 1:07 remaining.

Marvin Bagley III, taken one pick ahead of Doncic at No. 2 overall in last year's draft, scored 14 points for the Kings. Willie Cauley-Stein scored 16 points, and Bogdan Bogdanovic matched Bagley with 14.

Dirk Nowitzki, in a record 21st season with the same franchise, didn't play in the second half for the Mavericks after scoring nine points before halftime. There was no immediate report from the Mavericks on why the 40-year-old didn't return.

Sacramento Kings forward Marvin Bagley III (35) goes up for a shot over Dallas Mavericks' Dirk Nowitzki (41) as Kosta Koufos, second from right and Devin Harris (34) watch in the first half of an NBA basketball game in Dallas, Tuesday, March 26, 2019. (AP PhotoTony Gutierrez)

Sacramento Kings forward Marvin Bagley III (35) goes up for a shot over Dallas Mavericks' Dirk Nowitzki (41) as Kosta Koufos, second from right and Devin Harris (34) watch in the first half of an NBA basketball game in Dallas, Tuesday, March 26, 2019. (AP PhotoTony Gutierrez)

Coming off a season-high 21 points in a surprising blowout of Golden State, Nowitzki has four home games remaining in what is expected to be his final season.

Doncic's 3-point slump continued as he missed all nine from beyond the arc. He's shooting 22 percent in March. The 20-year-old was 10 of 11 from the free-throw line, where he has also struggled lately.

TIP-INS

Sacramento Kings forward Harrison Barnes (40) defends as Dallas Mavericks forward Luka Doncic (77) works to the basket in the first half of an NBA basketball game in Dallas, Tuesday, March 26, 2019. (AP PhotoTony Gutierrez)

Sacramento Kings forward Harrison Barnes (40) defends as Dallas Mavericks forward Luka Doncic (77) works to the basket in the first half of an NBA basketball game in Dallas, Tuesday, March 26, 2019. (AP PhotoTony Gutierrez)

Kings: G Yogi Ferrell, whose flashy debut with the Mavericks on a 10-day contract two years ago earned him longer-term deals with Dallas and Sacramento, had seven points against his former team. ... Fox was 11 of 12 from the line.

Mavericks: Doncic has seven of the eight triple-doubles by rookies this season. Atlanta's Trae Young, the fifth overall pick who was traded for Doncic on draft night, has the other. ... F Justin Jackson, who came to Dallas in the Barnes deal, started against his former team but had just two points.

UP NEXT

Kings: At New Orleans on Thursday.

Mavericks: At Miami on Thursday.

More AP NBA: https://apnews.com/NBA and https://twitter.com/AP_Sports