New York Knicks forward Carmelo Anthony reacts after a score...

New York Knicks forward Carmelo Anthony reacts after a score in the second half of their NBA game against the Milwaukee Bucks at the BMO Harris Bradley Center in Milwaukee, Wisconsin, USA, 06 January 2017. Credit: EPA / TANNEN MAURY

MILWAUKEE — Kristaps Porzingis was back on the court, making things difficult for “The Greek Freak,” Giannis Antetokounmpo. Things didn’t come as easily for the NBA’s other unicorn Friday night, especially in the fourth quarter.

The Bucks led by 18 points in the second quarter and 13 after three quarters, but the Knicks charged back behind an unlikely contributor down the stretch: undrafted rookie Ron Baker.

They outscored Milwaukee 33-15 in the fourth quarter, including the final eight points, and beat the Bucks, 116-111, to end their losing streak at six games.

“Oh, my God, we needed it,” Porzingis said. “We needed it more than anything right now.”

Said Carmelo Anthony, “At the end of the game, we wanted it more.”

Anthony had 26 points and 10 assists and hit a three-pointer with 51.1 seconds left to put the Knicks (17-19) ahead for good. Porzingis, who missed the previous three games with a sore left Achilles, scored 24 points and had three blocks before fouling out with 2:44 left.

Jeff Hornacek turned to Baker in the fourth quarter over starter Derrick Rose and Brandon Jennings. That move proved prudent.

Baker, whose contract becomes fully guaranteed this weekend, played the entire fourth quarter and had six points and two assists. He iced the game with two foul shots with 21.6 seconds left.

“I was surprised,” Baker said. “It’s the fourth quarter and I’m going in the game for my first minutes.

“To be in a game that’s tight like that gets the nerves going a little bit, but to get this game under my belt and get my first true win as an NBA player when I’m in the game feels good.”

Antetokounmpo, who made the game-winning jumper at the buzzer in Wednesday night’s win over the Knicks, scored 25 points but was 1-for-8 in the fourth quarter. Porzingis blocked or altered a few of those shots. Jabari Parker also had 25 for Milwaukee (18-17).

Just like Wednesday night, Antetokounmpo had the ball late in the game with Lance Thomas on him. On Wednesday, he hit the game-winner over Thomas. This time, with the Knicks up 112-111, Thomas dived to the court to force a turnover. Baker got the loose ball and fed Courtney Lee for a dunk to make it a three-point game with 27.1 seconds left.

“Lance came in at the end of the game and it came down to the same situation again,” Anthony said. “It was just a will at that point. It was mano-a-mano and he had the will to make that stop.”

After a timeout, Mirza Teletovic launched a three-pointer with 22.9 seconds left that missed, and Baker rebounded. He was fouled and made both from the line.

Hornacek said he went with Baker because he complemented the way Anthony was playing. “Melo was kind of dominating at the elbow area there,” Hornacek said. “We knew Ron could get us into those sets. Ron is just a heady guy. Sometimes he took the shot. Sometimes he drove in there.”

“He showed something tonight,” Anthony said.

After the Knicks cut a 61-43 second-quarter deficit to 69-68 in the third, the Bucks scored on 12 of their next 14 possessions to take a 96-83 lead. The Knicks scored the first 12 points of the fourth and got within 96-95 on Anthony’s three-pointer.

Later, after back-to-back three-pointers by Tony Snell put the Bucks up 104-97, Porzingis had a tremendous sequence. He drilled a three-pointer, twice denied Antetokounmpo from scoring inside and then knocked down a straightaway three-pointer from well beyond the arc to make it 104-103.

The Bucks went ahead 111-108 on Malcolm Brogdon’s layup with 2:36 left, but the Knicks’ defense finally made a stand and didn’t allow Milwaukee to score again.

“It feels good to get this skid off our back and get back the feeling of what winning feels like,” Anthony said. “Even though six games felt like the whole season, we stayed positive, we stayed with it. We were still positive about what we were trying to accomplish.”