Deron Williams scored a season-high 25 points in his return to the lineup, Brook Lopez added 24, and the Brooklyn Nets beat the Boston Celtics 104-96 Tuesday night in the first matchup for Paul Pierce and Kevin Garnett against their former team.

Garnett had 11 points, just his third time in double figures this season, and grabbed nine rebounds. Pierce finished with four points and seven rebounds in his first appearance off the bench in six years after making a quick recovery from a broken right hand.

But the key was Williams, who had missed nine straight games and 11 overall with a sprained left ankle, and hadn’t been sharp in the games in which he did appear.

The Nets won consecutive games for the first time this season, a stunning stat for a team that considered itself a championship contender after acquiring Pierce and Garnett in a blockbuster that was agreed to on draft night.

Both veterans had struggled, with the 12.4 points per game and .368 shooting by Pierce easily the lowest of his career before he was hurt on Nov. 29. Garnett, too, had barely made a mark, and the Nets had lost six straight at home, their longest losing streak since moving to Brooklyn.

Avery Bradley scored 22 points and Jeff Green had 19 for the Celtics, who have been competitive after trading away two of their most important players from their 2008 NBA championship team. Boston had a three-game winning streak snapped and its Atlantic Division-leading record fell to 10-13 record

The Celtics had started with 14-0 and 12-0 leads in their last two games, the latter eventually ballooning to a 45-point bulge in a 114-73 victory over the New York Knicks on Sunday that was the NBA’s most lopsided game this season.

Brooklyn got off to the strong start in this one, pulled away again after Boston tied it, and put it away when Williams, who came in averaging just 9.3 points, scored eight in the final period.

Pierce was expected to miss two to four weeks, but sat out only four games before returning to practice Monday. He received a nice ovation when he checked in midway through the first quarter, no doubt aided by the many Boston fans that were noticeable all around Barclays Center.

Garnett gave a pat on the head and a little hug to just before the opening tip to Boston’s starters, who go on to face former coach Doc Rivers and the Clippers on Wednesday.

The Nets led 31-20 after one, their largest lead after the opening quarter this season. Playing at a better pace than they have much of the season, they made 66 percent of their shots in the first half and led 56-47.

Boston quickly tied it at 60, but the Nets responded with 10 straight points, going ahead 70-60 on Williams’ jumper, and the lead reached 85-68 on Pierce’s free throw with 1:14 left.

NOTES: It was the first time Garnett played against the Celtics since March 4, 2007, for Minnesota. … Boxer Paulie Malignaggi was presented with the championship of Brooklyn belt by Barclays Center CEO Brett Yormark in the second quarter after beating fellow Brooklyn product Zab Judah in a welterweight bout here Saturday.

Join our Newsletter for the latest news right to your inbox