J.R. Smith registered 29 points on 9-of-12 shooting from 3-point range for the Knicks, who snapped their two-game losing skid.
Amar'e Stoudemire and Tyson Chandler scored 12 and 10 points, respectively, in the win.
New York kept its slim playoff hopes alive and pulled within two games of eighth place Atlanta for the final spot in the Eastern Conference.
DeMarcus Cousins tallied 32 points with 15 rebounds and Ben McLemore notched 16 points in the setback, Sacramento's fourth in its last six games.
Sacramento point guard Isaiah Thomas missed the contest with a quad contusion.
"I loved the fight, I loved the fact that we played with a lot of energy," said Kings coach Michael Malone. "I'm disappointed with our defensive effort as a whole. Give them credit. They made shots, they executed and they played like it was a must-win game for them."
Smith's 3-pointer at the end of the first gave the Knicks a 31-28 lead entering the second.
An 11-1 run midway through the second helped the Knicks to a 50-36 lead. Tim Hardaway Jr. opened the run with a a jumper and then closed it with a pair of free throws at 5:22.
Smith knocked down another trey minutes later to stretch the lead to 18, then the Kings cut the deficit to 13 before Anthony converted a jumper to close the scoring in the second with the Knicks up 63-48 at the break.
Anthony personally opened the third on a 6-0 run after hitting two 3s to push the halftime lead to 69-48 with just under 9 1/2 minutes to play in the frame.
The Knicks didn't hit another basket for another 2:37 when Iman Shumpert made a bank shot and Anthony followed with a 3 to make it a 74-50 game.
Cousins then scored seven straight points before McLemore capped a 10-0 run to cut the deficit to 14, but Anthony followed with a trey to push the spread to 77-60 with 3:33 left.
McLemore and Smith traded 3s to end the stanza with New York leading 86-72 after three.
McLemore opened the fourth with a triple to jumpstart an 8-0 run that pulled Sacramento within six, 86-80, with 9 1/2 minutes to play in the game.
A three-point play from Cousins minutes later cut the deficit to two, but Smith answered at the other end with a 3 followed by an Stoudemire dunk that gave the Knicks a 101-94 lead with 2:49 on the clock.
The Kings trailed by five when Anthony hit a pullup jumper with 1:36 remaining and Sacramento couldn't get any closer than six over the final minute.