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

Carmelo Anthony #7 of the New York Knicks controls the ball against the Phoenix Suns at Madison Square Garden on Friday, Jan. 29, 2016 in New York City. Credit: Jim McIsaac

All that stood between Carmelo Anthony and his first triple-double in nearly four years were two assists, and there were 12 minutes remaining.

No doubt he wanted it. But Anthony never set foot on the floor again Friday night, spending the final quarter of the Knicks’ 102-84 win over the Suns on the bench, a sleeveless gray shirt covering his game jersey.

His night was done, with no triple-double. “I keep flirting with it,” he said with a smile, his words laced with bemusement.

For the Knicks, letting Anthony relax for the entire fourth quarter clearly was for the greater good. Coach Derek Fisher called the additional down time “a blessing”; if Anthony’s 30-minute performance was any indication, rest agrees with him.

He returned from a two-game absence in which he nursed a sore left knee, and his all-around game looked better for the break. He had 19 points, 10 rebounds, eight assists and four steals as the Knicks avoided their first five-game losing streak of the season.

With the defending champion Warriors up next tomorrow night, Anthony said the Knicks needed to experience something positive after a rough stretch. “Our mindset was: Let’s not play with this game,” he said. “Let’s get after it right from the start.”

Arron Afflalo added 17 points and Robin Lopez had 13 for the Knicks, who took advantage of a Suns team that has been reeling. They have lost nine of their last 10 games and 18 of 20, leading to speculation about coach Jeff Hornacek’s job security.

Devin Booker, the youngest player in the NBA at 19, had 21 points for the Suns.

As the Knicks seek to stay within reach of a playoff berth, they delivered the type of dominant performance expected at home against a lesser opponent. Even though they were playing the second night of a back-to-back, they clearly were the better team. And their best player led the way.

“To be able to come back and get right back in the flow of the game, find a rhythm right away, not try to do too much and let the game come to me, that was my mindset,” Anthony said.

Anthony’s much-talked-about growth as a distributor this season was best demonstrated by a moment just before halftime.

He had the ball just inside the three-point line, looking for the final shot, but couldn’t lose P.J. Tucker no matter how many twists, turns and crossovers he tried. In past seasons, he almost certainly would have taken a contested last-second shot anyway. Not this year.

With no more than two seconds left, Anthony saw Sasha Vujacic to his left, several feet behind the three-point line. So he passed up the final shot, seemingly to the surprise of the Suns on the court. Vujacic, however, wasn’t surprised. He had enough time to catch and shoot from well beyond the arc, and his three-pointer opened an 18-point lead. It also gave Anthony his sixth assist in 18 minutes.

“He didn’t try to take over the game too much,” Fisher said. “That decision helped him see the floor. He has been playing that type of basketball for several weeks now.”

Anthony said his knee bothered him from time to time, but he was plus-33 in 30 minutes.

Kristaps Porzingis also returned after missing Thursday night’s game because of an upper respiratory illness, but he said he struggled with his breathing. Porzingis, seen coughing into his elbow at times, had seven points and seven rebounds in 24 minutes.

“Obviously,” Fisher said, “having Carmelo and Kristaps back helped us.”