Dinwiddie made the go-ahead basket with 11 seconds left as the Nets snapped a three-game losing streak to move past an embarrassing 34-point home loss to Detroit two nights earlier.

Atlanta guard Dennis Schroder finished with a career-high 34 points, but after causing matchup problems all night with his ball-handling, he missed his last two layup attempts and committed a game-ending turnover with 5 seconds remaining.

Kent Bazemore had 16 points for the NBA-worst Hawks, who have lost five of six.

Dinwiddie, who had just two points against the Pistons, was Brooklyn’s spark, recovering from a rough stretch late in the fourth when he let Schroder glide past him for an acrobatic layup and then lost the ball out of bounds on the ensuing possession.

After Dewayne Dedmon’s 3-pointer gave the Hawks their biggest lead at five, Dinwiddie immediately answered with a 3 with 2:20 left and then took charge at the end. He grabbed a defensive rebound and drew a foul on a fast-break layup with 11 seconds remaining.

Dinwiddie missed the free throw but battled for the rebound and got fouled again. This time he hit both free throws to make it 108-105. Schroder missed a layup and then was called for traveling on the same possession with 5.1 remaining.

Okafor, in his fourth straight game and sixth overall for Brooklyn, went 6 for 8 from the field in 12 minutes. The Nets acquired Okafor, the No. 3 overall draft pick for Philadelphia in 2015, in a trade early last month.

The Hawks trailed by nine in the first and the second, but forced a tie both times. Brooklyn took its first double-digit lead in the third on Tyler Zeller’s layup, but Atlanta went on an 11-0 run to take its first lead of the game, 67-66 on Tyler Dorsey’s 3.

Brooklyn’s DeMarre Carroll started and played 28 minutes after missing the last two games with a right knee sprain. He finished with 13 points. Rondae Hollis-Jefferson had 14 points and has scored in double figures in 12 of his last 13 games.

TIP-INS

Nets: Tied a season high with 29 assists. Caris LeVert had seven. Carroll and Hollis-Jefferson each had three.

Hawks: F Marco Belinelli, the team’s fourth-leading scorer, has a sprained left ankle and missed his first game.

CLOSE TO KIN

Nets coach Kenny Atkinson, who spent four seasons on Atlanta’s bench before getting hired in April 2016, knows everything about Hawks coach Mike Budenholzer’s San Antonio system and vice versa.

“We’re doing more Hawks stuff than the Hawks,” Atkinson deadpanned before the game