Brook Lopez's follow shot with 2 seconds left gave the Brooklyn Nets their fifth straight victory and a share of seventh place in the Eastern Conference, as they beat the New York Knicks 100-98 on Wednesday night.
The Nets blew a 16-point, second-half lead but escaped what could have been a crushing loss thanks to Lopez's effort on the boards on their last possession.
Deron Williams had 26 points, seven rebounds and seven assists in one of his best games of the season. And when he missed in the lane with the game tied at 98, Lopez tipped the ball once, then knocked it in on his second attempt.
Andrea Bargnani scored 22 points for the Knicks, who lost their eighth straight.
The Nets swept the season series for the first time since going 4-0 in 2006-07, and they tied Miami at 34-40. The Heat own the tiebreaker after beating Brooklyn all four times.
The Nets won for the ninth time in 11 games, but barely held on after appearing to run out of gas on their second night of a back-to-back.
Lopez finished with 18 points, well below the dominant numbers he had put up recently during his run as East player of the week, but just good enough to keep the Nets ahead of Boston in the race for the conference's final playoff spot.
Cleanthony Early scored 14 for the Knicks, who were far more competitive than during most of their skid. He missed a 3-pointer that would have won it on the final possession.
The Nets had a 16-point lead late in the third quarter after a 3-pointer by Williams, whose only game with more points this season was when he had 29 against the Knicks in the Nets' 110-99 victory on Nov. 7.
A night after scoring 33 in the first quarter, the Nets came back with 30 more in this one and led by nine after one. They pushed it to 14 early in the second but the Knicks trimmed it to 58-53 by halftime.
There seemed to be little interest in the finale of this season's New York City series. The only basketball buzz Wednesday in New York was for Hall of Famer Chris Mullin being introduced as the new coach at St. John's. The crowd at Madison Square Garden was quiet and disinterested for most of the game, unable to work up much energy to cheer the Knicks' roster full of little-known players or boo the ones from Brooklyn.
That all changed when the Knicks opened the fourth quarter with a 17-7 run that brought them to 92-88 on Early's 3-pointer midway through the period. They later cut it to one but threw up consecutive airballs with a chance to take the lead, then finally tied it at 98 on Early's 3-pointer with 1:07 to play.
Nets: Williams' 18 points in the first half were his high for any half this season. ... Brooklyn rookie Markel Brown shook off a hard fall early in the game when he was fouled trying to catch a lob pass. He finished with 14 points.
Knicks: New York had lost two games by 31 points during its skid and three others by 16 or more.
Nets: Host Toronto on Friday.
Knicks: Visit Washington on Friday.