Updated

Joe Johnson scored 32 points, Shaun Livingston helped Brooklyn dominate the second overtime after LeBron 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, 11 rebounds and five assists over 51 minutes in a sensational effort while starting for injured Deron Williams.

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.

James had 36 points, seven rebounds and five assists for the Heat, 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.

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, Kevin 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.

Alan Anderson opened overtime with a jumper after going scoreless in regulation, and neither team scored again until Johnson was credited with a basket on a goaltending call to make it 93-89 with 1:39 to play.

But Chris Andersen scored, and with James on the bench, Cole pushed the ball up the court and nailed a jumper with 3.3 seconds to go to tie it. Pierce was way off, and the teams went to a second extra session.

The Nets controlled it, 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, ripping off a 13-2 run early in the fourth to cut Brooklyn's lead to 80-79. James looked ready to fight when Mirza Teletovic wrapped his arms around James' neck to stop a drive to the basket with a flagrant foul.

Miami finally moved into the lead at 86-84 on Cole's 3-pointer, but it was tied at 89 with 40 seconds left after a free throw by James. The Nets maintained possession from there, keeping the ball after a foul and then an offensive rebound, but Pierce's long jumper rimmed out as time expired.

The Heat are off until Wednesday, when they continue their six-game road trip in Washington. A day earlier, they will visit the White House to be honored by President Barack Obama for winning their second straight NBA championship.

NOTES: The teams will also wear the nickname jerseys 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: http://www.twitter.com/Briancmahoney