Updated

Brook Lopez is just like Deron Williams. He enjoys visiting Dallas, too.

Lopez scored 38 points and Williams had 31 in his first visit since spurning his hometown team in free agency, leading the Brooklyn Nets past the Mavericks 113-96 on Wednesday night.

Williams scored 26 in the second half, repeatedly hitting shots and occasionally assisting on baskets by Lopez to prevent a Dallas rally in the fourth quarter.

Lopez matched the 38 points he scored in one of the five games he played last season, when the Nets snapped a 12-game losing streak in Dallas. Both times, he finished one point shy of his career high from two years ago against Detroit.

"The team played well in both games," Lopez said with a laugh. "I think that's the correlation. It just depends on who's hot. We have so many options on this team."

Williams and Lopez combined for a defining play midway through a fourth quarter full of big shots from both teams when Lopez blocked a shot and Williams hit a fadeaway jumper on the baseline after dribbling the length of the court. Williams ran to his bench with a big smile after Dallas called timeout trailing 97-88.

The Mavericks, who pulled within three twice during a back-and-forth quarter, got no closer than six after that.

"When you're feeling good and feel like you can't miss, it's a good feeling," said Williams, who shot 11 of 18 in the second half at one of his favorite arenas. "I looked over at my bench and saw the excitement. It's a big win for us. It's a big win no matter what."

Dirk Nowitzki led Dallas with 16 points and had a team-high six rebounds compared to 22 boards for Reggie Evans of the Nets, who outrebounded the Mavericks 45-34.

The Nets improved to 2-0 on a season-high, eight-game road trip that now makes five straight stops out West. Brooklyn is two road wins shy of the franchise record of 20.

The Mavericks, who fell 3½ games behind the Los Angeles Lakers for the final playoff spot in the Western Conference, lost the opener of a six-game homestand as they try to keep a 12-year postseason streak alive.

"They had two guys who had great games and we didn't do a good job there," Dallas coach Rick Carlisle said. "It's a bad result for us."

Lopez, who set a season high for points, and Williams led a third-quarter run that put Brooklyn ahead for good. Lopez did most of his scoring inside but had a 12-foot bank shot and another jumper from just inside the 3-point line as the Nets built a 10-point lead.

Lopez, who also had 11 rebounds, was 15 of 22 from the field and 8 of 10 from the line.

Williams scored seven of nine Brooklyn points to start the third quarter, and Lopez had the other two. They combined to go 11 of 12 from the field in the third, and the only miss was a desperation heave from beyond halfcourt by Williams at the end of the quarter.

Williams even got into the act on the defensive end, taking a charge from O.J. Mayo on a fast break with the Mavericks trying to stop Brooklyn's key third-quarter run.

"In the first half we kind of held him under control and then he knocked down a jumper and he was aggressive," Dallas forward Elton Brand said. "You could see it in his eyes. He was going to shoot it no matter what. We all know about free agency and our fans and us recruiting him. We knew he wanted to play well here."

Williams, who grew up in the Dallas area, got a smattering of boos during introductions and even fewer the first time he touched the ball. It wasn't his first game against Dallas since last summer. The Mavericks started March — their best month of the season by far — with a 98-90 win in Brooklyn.

Mavericks owner Mark Cuban, who infamously attended a "Shark Tank" taping instead of joining the Dallas contingent when free agency opened, intentionally stayed away from Brooklyn when the Mavericks visited. He still wasn't interested in Williams talk Wednesday.

"That's old, old, old, old news," Cuban said before the game.

Nets coach P.J. Carlesimo said he didn't know if Williams was a little extra motivated against the team he turned down so he could move to Brooklyn from New Jersey with the Nets.

"But I'm sure he understands that you're not going to expect intelligent statements from Mark, anyhow," Carlesimo said.

The Nets were actually better without Williams in the first half. While he was sitting to start the second quarter, Brooklyn went on an 18-6 run for a 40-38 lead.

Andray Blatche scored 14 in the second quarter for Brooklyn on 6-of-6 shooting, and not all of them were easy. He hit three long jumpers, two of them over Nowitzki.

NOTES: Nowitzki surpassed the 9,000-rebound mark and became the 10th NBA player with at least 24,000 points and 9,000 boards. ... Mavericks F Shawn Marion missed his eighth straight game with a left calf strain. ... Nets F Kris Humphries was a game-time scratch with a bad back. It was the eighth straight game on the bench for the former Maverick. ... The Mavericks spread the scoring wealth in the first half. Nowitzki, Chris Kaman and Mike James led with six points apiece, while Jae Crowder and Brandan Wright each had five.