Once again, Deron Williams wasn’t in the lineup in Brooklyn, and it caused problems for the Nets. But this time he was on the opposing team.

J.J. Barea — starting in place of the injured Williams, who didn’t play in his Brooklyn homecoming because of a strained hamstring after four-plus injury-plagued seasons with the Nets — had 32 points and 11 assists, and Dirk Nowitzki hit the go-ahead bucket in overtime to lift the Mavericks to a 119-118 win over the Nets at Barclays Center on Wednesday night.

“It felt good to fight. It felt like we left it all out there,” said Jarrett Jack, who missed a jumper in the closing seconds of overtime. “But we’re not into moral victories. When we put that type of effort on the court, we have to come away with Ws.”

Instead, they came away with the L after learning in heartbreaking fashion why Nowitzki’s name is where it is on the NBA’s all-time scoring list: sixth. Nowitzki, with Joe Johnson defending in the post, backed in for an up-and-under layup with 19.2 seconds left in overtime for a 119-118 lead. Nowitzki spoiled a wild Nets comeback and finished with 22 points, enough for him to pass Shaquille O’Neal on the career scoring list.

It was one of the more exciting Nets games to watch this season, but in the final seconds, Bojan Bogdanovic sure made for a strange spectator.

Bogdanovic, who had 17 points and hit all five of his three-point attempts, was on the bench late in the fourth quarter and in overtime, including the final possession. Lionel Hollins was asked after the game why he wasn’t in the game for the final play and said it was a “coach’s decision.” When pressed for his reasoning, Hollins abruptly left his postgame news conference.

advertisement | advertise on newsday

“Honestly, that’s the coach’s decision,” Bogdanovic said. “The guys on the court did a great job. So did that lineup to close the game to get a win. I don’t have any problem with that. I respect the coach’s decision.”

The Nets’ Thaddeus Young had 29 points and 10 rebounds and was instrumental in sending the game to overtime. Barea hit a floater plus the foul for a three-point play with 12.4 seconds remaining in regulation to put the Mavericks up 108-105. Young, who entered the game having shot 1-for-12 from three-point range this season, drained a contested three with 6.3 seconds remaining to tie the score at 108. On the ensuing possession, Young switched on to Barea on the pick-and-roll and blocked his fadeaway as time expired.

The teams exchanged three-pointer after three-pointer as the lead changed hands multiple times in the extra session, with Barea’s three opening a 117-116 advantage. Young later deflected Barea’s pass, leading to Brook Lopez’s hook shot for a 118-117 Nets lead with 42.1 seconds left. That set up Nowitzki’s winner, which denied the Nets a second straight victory after an impressive win over Chicago on Monday night.

“It’s still tough and disappointing, but it’s a little easier tonight,” said Lopez, who had 13 points and shot 6-for-15. “The way we’ve played for six quarters, you know these last games, roughly is how we want to play out the rest of the season. We really feel like we’ve come together as of late.”

But not in the first half, as the Mavericks shot 70.6 percent from the field and built a 16-point lead at one point. The Nets looked like a different team in the third quarter, scoring a season-high 34 points and holding Dallas to 17 to take a six-point lead that grew to 11 in the fourth.

Brooklyn Nets videos

“We have to bring the intensity that we had in the last two games to the next game and carry it over,” Young said. “If we keep playing like we’ve been playing, we’re going to win more games. It’s just going to happen.”

advertisement | advertise on newsday