The aggression that is the signature of Isaiah Whitehead’s game was working against him most of Wednesday night against the Lakers. He was showered with whistles by officials and spent most of the first three quarters on the bench. Still, he didn’t abandon his style when the fourth quarter started and it ended up paying big dividends for the Nets.

Whitehead provided the spark to ignite the Nets’ offense in the fourth quarter, and then a superior stretch of defense helped them pull out a 107-97 win before a sellout crowd of 17,732 at Barclays Center.

Whitehead had only eight points and two assists, but he had six of those points and both assists in a 20-12 burst in the middle of the fourth quarter in which the Nets took over a close game to end their two-game losing streak.

The Lakers didn’t manage a field goal against the Nets’ taut defense in the final six minutes, going 0-for-10. It was their eighth consecutive loss.

“Defensively we really got locked in,” Joe Harris said. “They didn’t get any easy looks at the end. We were really getting into them. They didn’t have any clear paths to the basket. And when they did miss, we put bodies on guys and didn’t give them second chances.”

“I really liked our defense in the fourth quarter,” Nets coach Kenny Atkinson said. “If we’re going to take a step, that’s where we need to take a step, defensively.”

advertisement | advertise on newsday

Bojan Bogdanovic had 23 points, Sean Kilpatrick had 22 points and five assists, Brook Lopez had 20 points, including eight in the final quarter, and Trevor Booker had 18 rebounds for the Nets. Kilpatrick has 20 or more points in four of his past six games.

Jeremy Lin, ruled out of the game about an hour before tipoff because of a tight lower back, will be re-evaluated Thursday and is considered day-to-day.

Lou Williams had 16 points, Nick Young had 14, Timofey Mozgov had 12 points and 13 rebounds and Jordan Clarkson had 12 points for the Lakers.

Whitehead’s aggression helped make him a star at Brooklyn’s Lincoln High School and then at Seton Hall. It’s one of the reasons the Nets liked him. But the rookie played only 15 of the first 36 minutes. Before the fourth quarter started, Whitehead said Atkinson “told me to keep being aggressive, keep playing the way I was playing when I got the fouls. I just went in there and if I saw an open shot, I went for it.”

He started the 20-12 burst with two free throws after he got fouled driving for a layup, and they made it 84-82 with 10:20 to play. He had a pair of driving layups in the burst, found Lopez for a wide-open layup and a 99-94 lead with 5:17 left and capped it with a long pass out of a drive to an open Harris. He made a three-pointer from the corner to make it 102-94.

Whitehead got a defensive rebound on the next possession, but fouled out less than a minute later, with 3:50 left.

“We felt like we needed his competitiveness, his defense,” Atkinson said of debating whether to start Whitehead in the fourth quarter. “Lucky decision . . . He made some big plays.”