NEW YORK (AP) -- Shaun Livingston was flying all over the court. LeBron James could only sit and watch.
Joe Johnson scored 32 points, Livingston helped Brooklyn dominate the second overtime after James fouled out, and the Nets beat the Miami Heat 104-95 on Friday night for their fifth straight victory.
Livingston had two baskets and two blocked shots in the second OT, finishing with 19 points, a career-high 11 rebounds and five assists over 51 minutes in a sensational effort while starting for injured Deron Williams.
The Nets followed the lead of a player who spent years revitalizing a career that was sidetracked by a horrific knee injury, jumping on the Heat early and fighting them off late.
''Gutsy. Gutsy,'' Kevin Garnett said. ''I thought we fought for 48-plus minutes.''
Paul Pierce scored 23 points but missed jumpers that could have won it at the end of regulation and the first overtime. Still, the Nets remained unbeaten in 2014, adding a victory over the two-time defending NBA champions to their recent wins over Oklahoma City and Golden State.
''It was huge,'' Livingston said. ''We've obviously been playing better as of late. I think our momentum that we were carrying into this game, we're trying to ride that wave.''
James had 36 points, seven rebounds and five assists, but fouled out on an offensive foul with 36 seconds left in the first overtime and the Heat trailing by two.
Miami pushed it to a second overtime without him, but it was all Nets from there against a Heat team that was already missing Dwyane Wade and two other starters.
James was visibly frustrated with his teammates in the first half - he said he apologized at halftime for his attitude and body language. He was irate when Mirza Teletovic flagrantly fouled him, but nearly overcame all that to help Miami pull it out.
''We're a no-excuse team, but right now we have three starters that didn't play,'' James said. ''Even though we've got a lot of depth, it is hard to make up for three starters being out.''
Miami totaled six points in the overtimes, fewest ever in the shot clock era (since 1954-55) in a game that went at least two overtimes.
Norris Cole scored 18 points, but Ray Allen was 2 of 14 for nine points in place of Wade, who rested his sore knees after playing 39 minutes in a loss at New York on Thursday. Shane Battier and Mario Chalmers also sat out the game, which featured players on both teams wearing nicknames on their jerseys, a first of its kind in the NBA.
Livingston and Johnson made the first two baskets of the second overtime, then Livingston blocked a shot by Cole.
Pierce followed with a 3-pointer, Garnett made a jumper and Livingston spun into the lane for a dunk and a 104-93 lead. He had another block on Allen, who finally made the Heat's only basket of the second OT on a wide-open layup with 16 seconds to go.
The Heat came up with the idea to wear nicknames on their jerseys and wanted another team to participate, and the Nets were selected.
So in place of the teams' regular jerseys were ones reading names such as King James and J. Shuttlesworth (for Allen's character, Jesus Shuttlesworth, in the film ''He Got Game.'')
The Nets wore their road black jerseys with Truth (Pierce) and Big Ticket (Garnett).
Gimmicks are nice but good games are even better, and the Heat and Nets delivered a great one.
''This was a playoff atmosphere-type game,'' Pierce said. ''You just felt the energy in the building.''
The Nets led 93-89 in the first OT and were still up two after James fouled out, but Cole pushed the ball up the court and nailed a jumper with 3.3 seconds to go to tie it.
The Nets controlled the second extra period, handing Miami a second loss in two nights in the Big Apple and matching their win total for both November and December, with eight games left this month.
Even short-handed, James and the Heat played as though they desperately wanted this one, erasing a 14-point deficit. James looked ready to fight when Teletovic wrapped his arms around James' neck to stop a drive to the basket with a flagrant foul.
''He went around my neck,'' James said. ''It's not a basketball play.''
Said Teletovic: ''Just tried to make a foul to stop the score. He shouldn't be reacting like that. It's OK. It's just basketball.''
It was tied at 89 with 40 seconds left after a free throw by James, and Pierce's long jumper rimmed out as time expired.
''They made bigger plays going down the stretch in the overtime,'' Heat coach Erik Spoelstra said. ''When we pushed it to that point, even with LJ out, we thought we had a chance. Guys really competed down the stretch.''
NOTES: The teams will wear the nickname jerseys again on March 12 and April 8 in Miami. The Heat will also wear them at home against Boston on Jan. 21. ... The Nets begin a three-game, three-country road trip Saturday in Toronto. They face the Atlanta Hawks on Thursday in London, then return home to visit the Knicks on Jan. 20.
Follow Brian Mahoney on Twitter: https://www.twitter.com/Briancmahoney