NEW YORK (AP) -- Brook Lopez scored 23 points, Joe Johnson added 22 and the Brooklyn Nets beat the New York Knicks 98-93 on Tuesday night, improving to 2-0 this season against their city rivals.

Brooklyn Nets guard Jorge Gutierrez (13) and New York Knicks guard Tim Hardaway Jr. (5) scramble for a loose ball in the first half of an NBA basketball game at Madison Square Garden in New York, Tuesday, Dec. 2, 2014. (AP Photo/Kathy Willens)

Deron Williams finished with 19 points for the Nets, who won for just the third time in 10 games after blowing most of a 16-point, second-half lead.

Carmelo Anthony had 20 points, nine rebounds and six assists, but missed a potential tying 3-pointer with about 5 seconds left as the Knicks lost their fifth straight. They fell to 4-15.

Jose Calderon had 19 points and seven assists for New York, and Amare Stoudemire added 17 points and nine rebounds in his third start this season.

(Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)