NEW YORK -- As Detroit kept coming back, Joe Johnson figured the game could come down to a last shot.
It did and he knew it was in as soon as it left his hands.
Johnson made a jumper from just inside the arc as time expired in the second overtime, giving the Brooklyn Nets a 107-105 victory over the Pistons on Friday night.
Johnson finished with 28 points for the Nets, scoring their final five in the second extra period. He faded backward after launching the jumper over Tayshaun Prince in something of a victory trot.
"The coaches and, like I say, my teammates have the confidence in putting the ball in my hands down the stretch, then I have to come up big for us," Johnson said.
Gerald Wallace added a season-high 25 points and 10 rebounds, Deron Williams scored 17 points and Andray Blatche had 16 for the Nets, who blew a 17-point lead, missed their first six shots in the second overtime, and still managed to win their second straight.
The Nets said Johnson's jumper was their first buzzer-beating victory since Feb. 23, 2009, when Devin Harris hit a game-winner against Philadelphia.
"We fought all game and he carried us through the fourth quarter and overtimes," Williams said of Johnson, "and I don't think anybody wanted to play a third overtime, so I guess he knew we needed to get to Chicago."
Detroit led 103-100 in the second overtime before Wallace drove into the lane to get the Nets on the board. Johnson put them in the lead with a basket in the lane, making it 104-103, and after Greg Monroe wasn't close on two free throws, Johnson added a free throw that made it 105-103 with 10.5 seconds left.
Knight missed a jumper, but the Nets' Kris Humphries tipped it right to Kyle Singler under the basket, who tied it with 5.8 seconds to go. The Nets got the ball into Johnson, who was well defended by Prince before stepping back for the long jumper that had to be reviewed to see if it was a 2-pointer or a 3.
Wouldn't have mattered. Johnson left no time for another Detroit comeback.
"It seemed like when he let it go, the ball is in the air forever," Prince said. "If it was a situation where he got in the paint and made something, then I'd be a little bit upset. But those type of shots, you can't control when a guy steps back and hits a 3-point shot for the win. I just feel so bad for our guys, man. They worked so hard for this, man. They fought and fought and fought."
Brook Lopez had nine points in 23 minutes for the Nets after missing seven games with a sprained right foot. Coach Avery Johnson said his leading scorer would be limited to about half the game, so Lopez watched the extra periods. Johnson said the Nets would evaluate Lopez to see if he would play Saturday against the Bulls.
His return made an immediate difference for the Nets in the first half, but they couldn't keep the Pistons off the backboards down the stretch, allowing them to come back.
Monroe had 17 points for the Pistons, who surrendered a 21-1 run in the second quarter, wiped out the Nets' lead by the end of the third, went ahead in the closing minutes of the fourth, but couldn't hold on to give coach Lawrence Frank, a Jersey guy and former Nets coach, a victory in his first game in Brooklyn.
"We showed great resolve, great fight and we competed extremely hard," Frank said. "There's no one there that's happy with the consolation prize, (but) disappointed that we came up short because we know we got it in both regulation and overtime. We got the stop, We just couldn't finish the play."
Detroit, which lost a basket to a shot-clock violation after a video review, blew a six-point lead in the final 90 seconds of regulation. Stuckey had three baskets in the first extra period to give Detroit a two-point lead with 41 seconds left, before Johnson tied it on a floater with 18 seconds remaining. Stuckey then missed a jumper that could have won it.
Trailing by four in the second quarter, the Nets blew by the Pistons with the big run that gave them a 54-38 lead on Blatche's layup with 2:38 to play. Brooklyn extended it to 17 points later in the period and was ahead 59-47 at halftime.
The Nets played without Jerry Stackhouse, who had a sore right knee. Johnson said Stackhouse was hurt when his leg crashed into Jason Kidd's on Kidd's tiebreaking 3-pointer with 24 seconds left in the Knicks' 100-97 victory here on Tuesday. Stackhouse was called for a foul on the play. Johnson called the collision a "rough tumble." ... Frank, who coached the Nets from 2004 until early in the 2009-10 season, praised the Barclays Center, saying he'd been invited by the Nets to attend one of the Jay-Z concerts that opened the building in September.
NBA commissioner Adam Silver acting like a rock star at the 2016 NBA Draft, but don't forget the days of David Stern getting booed out of the building.
In selecting Washington's Dejounte Murray, 19, the Spurs see a combo guard who possesses enough upside to develop into one of the draft's steals.
The Indiana Pacers selected Iowa State small forward Georges Niang with the No. 20 pick in the second round (No. 50 overall) of the 2016 NBA draft on Thursday night.