SACRAMENTO, Calif. — Phil Jackson wants Carmelo Anthony to get rid of the ball quicker, and he did for most of Friday night’s game.

Anthony was quick to shoot and to pass to his teammates, and he carried the Knicks offensively for three quarters. It wasn’t a good finish for him, but the Knicks still were able to pull out a 103-100 win over the Kings at Golden 1 Center in the opener of a five-game western swing.

“It was an ugly win,” Anthony said after scoring 33 points and dishing out four assists.

The Knicks (13-10) had several chances to put the game away down the stretch and ended up making just enough plays to hold off the Kings. Anthony, who scored 23 points in the first half, missed a couple of late three-pointers and two foul shots with 2.6 seconds to go.

After DeMarcus Cousins rebounded the second miss, his heave from beyond midcourt hit the front of the rim as the Knicks escaped with the victory. Cousins, who scored 28 points, also missed a potential go-ahead layup with 21.9 seconds left.

advertisement | advertise on newsday

Anthony, who was 12-for-14 from the line, made two free throws with 14.8 seconds left for the last points of the game.

“I missed the two that really counted,” he said. “Kind of out of my character to miss those two, but it happens. We still take the win.”

With the Knicks ahead by three, Rudy Gay misfired on a three-pointer with 3.9 seconds to go that went out of bounds off Darren Collison. The original call was that it was off the Knicks, but the referees reviewed it and reversed the call.

Anthony was fouled and missed both, but the Knicks still survived, in part because Joakim Noah made his free throws.

With the Kings leading 98-97, they intentionally fouled Noah with 2:09 left. He had missed 12 of his last 13 from the line, including all four when the Kings intentionally fouled him at the Garden last Sunday. This time Noah made both foul shots to give the Knicks a 99-98 lead.

“It felt really good,” Noah said. “I’m not even going to lie. I needed that.”

Derrick Rose, who has missed the last two games because of back spasms, hopes to return Sunday night against the Lakers. Starting in Rose’s place, Brandon Jennings had 13 points and seven assists. Kyle O’Quinn added eight points and 11 rebounds for the Knicks, who have won 10 of their last 14.

“We needed this game,” said Kristaps Porzingis, who had 17 points and 10 rebounds. “It was a must-win game for us to start the road trip the right way. We’re lucky that we were able to win the game at the end. We made it interesting.”

The game provided a positive finish to the day for Anthony, who said he was “caught off guard” by Jackson’s critical comments about him being a ball-stopper. He said earlier in the day that he wishes Jackson had spoken to him privately and added that the Knicks don’t need “any negativity” right now.

Anthony said there is “a temporary black cloud” over the Knicks brought on by Jackson’s statement that Anthony holds the ball too long. Anthony said he doesn’t understand why Jackson made those remarks, especially given that the Knicks have been winning.

advertisement | advertise on newsday

“At the end of the day, we’re playing good basketball,” Anthony said. “That’s the only thing that really matters at this point. Any negativity that’s coming toward me or toward the team, I don’t think we need it at this point, especially when we’re trying to make a run.’’

Jackson’s comments came in an interview with CBS Sports Network that aired Tuesday. He said Anthony has “a little bit of a tendency to hold it for three, four, five seconds, and then everybody comes to a stop.”

Later that night, Anthony scored 35 points to lead the Knicks over the Heat. He also hit two game-winning shots in a four-game span during a 9-3 stretch for the Knicks.

Anthony said he hasn’t talked to Jackson recently and won’t pursue a conversation. Jackson is expected to meet the Knicks in Los Angeles.

“If he wants to talk about it, cool,” Anthony said. “If he don’t, cool. In my eyes, it’s over with.’’

advertisement | advertise on newsday

Anthony said Jackson has never spoken to him about holding the ball too long. “I just feel if it was something that he wanted to address or had a stance on something, the door has always been open both ways,” Anthony said. “He’s always sent me a text or talked to me. If it was any type of problem or anything going on, I always welcome his conversation with open arms and I’ve sat there and would listen.

“It’s always been good conversations when we talked. I don’t really know what’s going on.”

Anthony added, “My conversations with management is limited at this point. I’ve decided to focus on what I can focus on and let them focus on what they focus on.”