CHICAGO (AP) — Spencer Dinwiddie scored 27 points off the bench and made a critical defensive play in the final seconds, lifting the Brooklyn Nets over the Chicago Bulls 96-93 on Wednesday night for their seventh consecutive victory.

Jarrett Allen had 16 points and 12 rebounds for the resurgent Nets (15-18), who have put together the NBA’s longest active winning streak on the heels of an eight-game skid. Brooklyn was coming off a 115-110 victory at home Tuesday night over LeBron James and the Los Angeles Lakers.

CHICAGO, ILLINOIS – DECEMBER 19: Rondae Hollis-Jefferson #24 of the Brooklyn Nets shoots against Wendell Carter Jr. #34 of the Chicago Bulls at the United Center on December 19, 2018 in Chicago, Illinois. NOTE TO USER: User expressly acknowledges and agrees that, by downloading and or using this photograph, User is consenting to the terms and conditions of the Getty Images License Agreement. (Photo by Jonathan Daniel/Getty Images)

Kris Dunn scored 24 points for Chicago, which has the worst record in the league at 7-25 after dropping 12 of its last 14. Bobby Portis added 16 points and 11 rebounds for the Bulls before exiting in the final minute with an apparent leg injury.

Chicago led 93-92 before Joe Harris put Brooklyn ahead to stay on a floating bank shot with 43 seconds left.

But the key to the win was the Nets’ defense on the last two possessions. First, they forced Lauri Markkanen into an offensive foul. Following a Brooklyn turnover, Dinwiddie then deflected a handoff to Dunn at the top of the key and Harris gathered the loose ball with 2.3 seconds to go.

Dinwiddie was fouled with 1.4 seconds left and made both free throws for a three-point margin. Chicago, which was out of timeouts and couldn’t advance the ball, never got a shot off that could have tied the game.

Brooklyn entered averaging 121.5 points per game during the winning streak, but points were tough to come by in the first half.

Chicago held a 27-22 edge at the end of the first quarter before the Nets rallied for a 40-39 halftime lead despite 6-for-18 shooting in the second period. Dinwiddie had 10 of his team’s 18 points in the second on 3-for-4 shooting, including 2 of 3 on 3-pointers.

Both teams stepped up the offensive production in the third quarter and the score was tied at 71 entering the fourth.

The Bulls picked up their defensive intensity early in the fourth — including some full-court pressure — to force Brooklyn into a few sloppy turnovers. The result was an 86-80 Chicago lead midway through the quarter, but the Nets answered with seven straight points to regain the lead.

Copyright 2018 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.