Carmelo Anthony goes into traffic and jams against Aaron Gordon,...

Carmelo Anthony goes into traffic and jams against Aaron Gordon, right, in the first half Friday night at Madison Square Garden. Credit: Jim McIsaac

With the third quarter winding down, Carmelo Anthony had the ball near the top of the arc and saw Kristaps Porzingis cutting to the basket. Anthony threw a gorgeous shovel pass inside for a Porzingis dunk.

Things came that easily for the Knicks on Friday night, which hasn’t happened much lately. The Knicks led by 24 points and were up by double-digits for the last 32:54 in their 108-95 victory over the Orlando Magic at the Garden.

It was only their third win in the last 16 games and snapped a six-game home losing streak.

“That’s the way we need to play,” Porzingis said. “Everybody was involved, everybody was attacking, everybody was trying to be aggressive.

The Knicks (25-35) got a balanced effort, as all five starters scored at least 14 points and seven players scored in double figures. Anthony had 19 points, 11 rebounds and six assists. Porzingis added 18 points and Jose Calderon, Arron Afflalo and Robin Lopez each had 14. Lance Thomas and Derrick Williams scored 11 each.

”Offensively, it seemed like we had some flow,” Anthony said. “Guys felt comfortable, confident out there on the offensive end.”

Chants of “We want Jim-mer” were heard at different points, including late in the fourth quarter, when the game was out of reach. But Kurt Rambis did not put Jimmer Fredette in the game.

Nikola Vucevic led the Magic (25-32) with 18 points, but only two came in the second half. Aaron Gordon had 17 and Victor Oladipo 16.

Magic coach Scott Skiles declared this “a must-win” game beforehand, but his players must not have gotten the memo.

The Magic looked like a team that had played the night before and probably felt the effects of having to chase down Stephen Curry, who scored 51 points in Golden State’s 130-114 victory over Orlando.

Orlando’s defense wasn’t that much better against the Knicks; they just aren’t the explosive team the Warriors are. The Knicks led 82-69 at the start of the fourth quarter and pushed it to 93-73 after six straight points by Porzingis early in the quarter.

“I thought we did a lot of good things,” Rambis said. “We attacked the basket. We attacked inside. We know they played last night, so we wanted to go after them.”

Calderon has been scrutinized for his inability to contain quicker guards, but he remains one of the better shooters in the NBA. The Knicks have been urging him to shoot more, and in the last two games, he has. After scoring 20 in Wednesday night’s loss in Indiana, Calderon opened this game by scoring 10 of the Knicks’ first 17 points. He was 5-for-5 in that stretch.

The Knicks followed Calderon’s lead, took a 32-20 lead late in the first quarter and extended their cushion to 20 in the second quarter.

They got timely contributions from Williams and Jerian Grant off the bench. Neither played Wednesday night in Indiana, but they provided a spark in the first half, which ended with the Knicks up 62-44. Williams scored nine points in 10 minutes. Grant was aggressive on both ends and did a good job running the offense and setting up his teammates.

“It feels good to get a win at home,” Anthony said. “We just want to build off of this.”