Carmelo Anthony #7 of the New York Knicks controls the...

Carmelo Anthony #7 of the New York Knicks controls the ball in the second quarter against the Charlotte Hornets at Madison Square Garden on Friday, Jan. 27, 2017 in New York City. Credit: Jim McIsaac

It was a victory, and the Knicks will take any of those that they can get these days.

But even as they beat the Charlotte Hornets, 110-107, on Friday night, the ongoing saga engulfing their biggest star colored another strange evening at the Garden.

Carmelo Anthony had 18 points and scored the basket that essentially sealed the game — a fadeaway jumper with 13 seconds left that gave the Knicks (21-27) a 109-105 lead.

But Anthony, around whom trade winds continue to swirl, also was the subject of scattered boos and widespread jeers and concerned murmurs from the crowd as he missed key shots in the fourth quarter.

They included a three-point try on which he hit the backboard but missed the rim.

Earlier, Anthony was jeered as he missed the first two of three free-throw tries, then received mock cheers when he made the third.

Had he heard the fans getting on him down the stretch? “Yeah, I enjoy that; I enjoy it,” he said sarcastically after finishing 8-for-26 from the field (1-for-6 in the fourth quarter), including 1-for-7 on three-point shots, and pulling down 11 rebounds.

Anthony also was asked if he thinks fans’ attitude about him contributed to his failure to make the Eastern Conference All-Star roster. “I don’t know,” he said. “Honestly, I don’t know. It’s kind of hard to think about that right now in the midst of everything that’s going on.”

The same could be said of the entire Knicks team, but after winning only four of their previous 18 games, they savored a victory over the Hornets (23-24), who could be in their way as they seek a playoff push.

Five players scored at least 15 points, including Kristaps Porzingis, who scored 16 of his 18 in the first half and made his first six shots from the field, an encouraging sign after a recent shooting slump.

But the real star was Courtney Lee, who scored 16 points, nine in the fourth quarter, capped by a three-pointer with 1:38 left that put the Knicks ahead to stay at 102-101.

Brandon Jennings, who scored 15 off the bench and filled in after Derrick Rose left with an ankle sprain, added a corner three-pointer with 1:19 remaining to make it 105-101.

It was 107-105 when Anthony made his big shot.

Kemba Walker, a recently minted All-Star who grew up in New York City, led the Hornets with 31 points, 10 rebounds and five assists.

After yielding 36 points in the third quarter, the Knicks stiffened defensively in the fourth, allowing only 20. The Hornets went six minutes without a single point during the quarter. “We played defense; it’s as simple as that,” coach Jeff Hornacek said.

Said Lee, “Everybody was out there playing for each other tonight . . . It was fun.”

The Knicks are 3-3 in their past six games and believe they still are within sight of a playoff berth. But no one knows whether Anthony will be along for that ride.

“Every time you look at your phone, it’s something about Melo getting traded,” Jennings said. “As a team, I think we’re doing a good job just staying focused, guys staying together, encouraging Melo to keep playing and don’t worry about that. I don’t want to see Melo go. He’s a big part of this team.”

Said Anthony, “When I’m out there between those lines, that’s all I think about . . . Everything else is second fiddle to me when I’m out on that court.”

Notes & quotes: Hornacek said X-rays of Rose’s left ankle were negative and was unsure how much time he will miss, if any . . . The Knicks wore throwback jerseys representing their inaugural season of 1946-47 in recognition of their 70th anniversary . . . Both teams’ head and assistant coaches wore bow ties in tribute to National Basketball Coaches Association executive director Michael Goldberg, who died last week.

Newsday LogoSUBSCRIBEUnlimited Digital AccessOnly 25¢for 5 months
ACT NOWSALE ENDS SOON | CANCEL ANYTIME