Kevin Durant scored 24 points, James Harden had 23 points and 12 assists, and the Brooklyn Nets beat Dallas 102-99 on Tuesday night, handing the Mavericks their fifth consecutive home loss.

The Eastern Conference-leading Nets erased a 17-point third-quarter deficit to avoid back-to-back losses for the first time this season. Brooklyn squandered a double-digit lead after halftime in a loss to Chicago.

Luka Doncic scored 28 points but had another rough night from 3-point range except for the 30-footer he banked in just before the first-half buzzer. Kristaps Porzingis had 17 points and 12 rebounds.

Dallas Mavericks guard Luka Doncic (77) takes a shot as Brooklyn Nets' LaMarcus Aldridge, left, and Dwight Powell (7) look on in the first half of an NBA basketball game in Dallas, Tuesday, Dec. 7, 2021. (AP PhotoTony Gutierrez)

Dallas Mavericks guard Luka Doncic (77) takes a shot as Brooklyn Nets' LaMarcus Aldridge, left, and Dwight Powell (7) look on in the first half of an NBA basketball game in Dallas, Tuesday, Dec. 7, 2021. (AP PhotoTony Gutierrez)

Harden, who also had nine rebounds, easily beat Doncic one-on-one for a layup and Brooklyn’s biggest lead at 100-97 with 1:23 remaining. The Nets didn’t take their first lead until the middle of the fourth quarter.

Dallas didn't make a basket after Doncic's short jumper with 3:51 to go and finished 9 of 46 (19.6%) from long range. Tim Hardaway Jr. missed all seven from deep, including an open look that bounced off the back of the rim at the buzzer.

The Nets trailed by 11 entering the fourth quarter and slowly cut the deficit, led by Durant, who made 5 of 6 shots and scored 11 points in the final quarter.

Dallas Mavericks center Kristaps Porzingis (6) loses control of the ball on a shot attempt as Brooklyn Nets' LaMarcus Aldridge, left, and DeAndre' Bembry, right, defend during the first half of an NBA basketball game in Dallas, Tuesday, Dec. 7, 2021. (AP PhotoTony Gutierrez)

Dallas Mavericks center Kristaps Porzingis (6) loses control of the ball on a shot attempt as Brooklyn Nets' LaMarcus Aldridge, left, and DeAndre' Bembry, right, defend during the first half of an NBA basketball game in Dallas, Tuesday, Dec. 7, 2021. (AP PhotoTony Gutierrez)

Nic Claxton missed two free throws with Brooklyn leading by three with 20 seconds remaining, but Doncic missed from beyond the arc before Hardaway's miss. Doncic was 3 of 11 from deep.

The Mavericks (11-12) dropped below .500 for the first time since getting blown out by Atlanta in their opener despite the return of both Doncic and Porzingis. They both missed the previous loss to Memphis, the first time that's happened this season.

TIP-INS

Brooklyn Nets guard James Harden talks to referee Aaron Smith during the first half of the team's NBA basketball game against the Dallas Mavericks in Dallas, Tuesday, Dec. 7, 2021. (AP PhotoTony Gutierrez)

Brooklyn Nets guard James Harden talks to referee Aaron Smith during the first half of the team's NBA basketball game against the Dallas Mavericks in Dallas, Tuesday, Dec. 7, 2021. (AP PhotoTony Gutierrez)

Nets: James Johnson had 12 points on 5-of-7 shooting against his former team. Johnson started the 2020-21 season in Dallas before a trade to New Orleans. He signed with Brooklyn as a free agent. ... LaMarcus Aldridge, playing in his hometown, had 15 points.

Mavericks: Doncic was called for a technical foul after he shoved Claxton in front of an official in the third quarter. Doncic appeared to think Claxton was crowding him after the whistle. Doncic tried to show his displeasure by sitting in an open courtside seat as Durant went to the other end to shoot the free throw, which he made. ... Dorian Finney-Smith scored 15 points and was the only Dallas player consistently hitting 3s, going 4 of 9.

UP NEXT

Dallas Mavericks forward Tim Hardaway Jr. and guard Frank Ntilikina (21) defend against Brooklyn Nets guard James Harden (13) during the first half of an NBA basketball game in Dallas, Tuesday, Dec. 7, 2021. (AP PhotoTony Gutierrez)

Dallas Mavericks forward Tim Hardaway Jr. and guard Frank Ntilikina (21) defend against Brooklyn Nets guard James Harden (13) during the first half of an NBA basketball game in Dallas, Tuesday, Dec. 7, 2021. (AP PhotoTony Gutierrez)

Nets: The second game of a four-game trip is a back-to-back in Houston on Wednesday. Harden visited his former team in March last season, less than two months after forcing the trade to the Nets. He scored 29 points in a 132-114 Brooklyn win.

Mavericks: Their second back-to-back in a span of five days is Wednesday. Memphis is the opponent, just as it was in that 97-90 loss Saturday.

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