Brooklyn Nets registered a thrilling victory over the Detroit Pistons 107-105 after second overtime Friday night.

Joe Johnson knocked down a jumper as time ran out in second overtime to take the Nets to their 13th win of the season.

Johnson finished with 28 points on 12 from 22 attempts from the floor, while Gerald Wallace scored 25 points and chipped in with 10 rebounds.

Johnson scored five points in second OT, which in the end proved to be instrumental in his team's victory.

"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," the Associated Press quoted Johnson as saying.

Deron Williams finished with 17 points and six assists for the Nets, whereas Andray Blatche added 16 points and had two steals.

Johnson's jumper was the first time since Feb. 2009, that the Nets have beaten any team on a buzzer-beating shot.

"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."

For the Pistons, Brandon Knight was the top scorer with 22 points, while also adding five rebounds and five assists. Rodney Stuckey scored 19 points and chipped in with six rebounds, while Greg Monroe finished with 17 points and eight rebounds.

The Pistons outscored the Nets 25-23 in the first quarter, but were easily trumped in the second 36-22. That gave the Nets a 59-47 lead at halftime. However, they could not keep the momentum going and the Pistons forced a tie at 90-90 at the end of the fourth quarter.

In the first OT both teams scored 10 points apiece, and with it stretching the game to second OT.

At one point of time, the Pistons were leading 103-100. But, soon Johnson took his team to a leading position at 104-103 with a basket. Later Johnson's free throw extended the lead to 105-103 with 10.5 seconds remaining in the game, before his game winner sealed victory.

"It seemed like when he let it go, the ball is in the air forever," Tayshaun 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."