SACRAMENTO, Calif. -- Even against the Western Conference's worst teams, nothing is coming easy for the New York Knicks right now.
Carmelo Anthony scored 36 points, J.R. Smith tied a franchise-record with nine 3-pointers and the Knicks held off a furious rally to beat the Sacramento Kings 107-99 Wednesday night and move a game closer to the final playoff seed.
''We needed all of them, I'll tell you that,'' Knicks coach Mike Woodson said, shaking his head in relief.
A night after a lackluster 127-96 loss at the Los Angeles Lakers, the Knicks avoided a monumental collapse to another of the league's cellar-dwellers.
New York led by 24 in the third quarter before Sacramento surged back, and the Knicks needed a scintillating shooting performance from its leading men to snap a two-game skid.
Smith scored 29 points on 10-for-19 shooting, including 9 for 12 from long distance. Anthony shot 12 for 21 from the floor and 5 of 8 from beyond the arc.
''That was big time,'' Anthony said.
New York (30-42) is two games behind Atlanta for the final playoff spot in the weak Eastern Conference after the Hawks (31-39) lost 107-83 to Minnesota.
DeMarcus Cousins had 32 points, 15 rebounds and eight assists to carry the Kings, who played without injured point guard Isaiah Thomas (bruised right quadriceps). Ray McCallum made his first start in Thomas' place alongside fellow rookie Ben McLemore, and the two shook off a slow start to bring the Kings back.
McCallum had 10 points, six rebounds and five assists. McLemore scored 16. But New York outshot Sacramento 54.8 percent to 47.8 percent and finished 15 for 26 from 3-point range.
''The 3-point line killed us,'' Kings coach Michael Malone said. ''You have J.R. Smith and Carmelo Anthony, that's going to be tough to beat.''
About the only thing that kept the Kings close most of the night- besides Cousins -- was free throws. Sacramento shot 27 for 35 on free throws, while New York finished 12 for 13.
Sacramento scored the first eight points of the fourth quarter and finished with a flurry of highlights to give the Knicks a scare.
Cousins' three-point play over Amare Stoudemire trimmed New York's lead to 96-94 with 4:30 remaining, sending most of the announced crowd of 15,494 roaring to their feet.
Smith answered with a 3-pointer, and Tyson Chandler came back with a dunk to put the Knicks up 101-94. After McCallum made two free throws, Anthony's 15-footer with 1:36 to play sent a cluster of fans to the exits, and the rest soon followed.
''We know what they wanted to do,'' Cousins said, ''but we have to go out there and execute.''
The Knicks already assured themselves of a losing season with an embarrassing loss in Los Angeles on Tuesday night with new team president Phil Jackson in attendance. The former Lakers coach, a longtime nemesis of Kings fans, was nowhere to be found in Sacramento on this night.
Not that the Knicks should've needed Jackson's presence to get by a rebuilding Kings team that is far from the franchise he often led the Lakers past in the playoffs during Sacramento's glory years.
New York took control in the second quarter with 20-6 run highlighted by defense and dunks. Chandler capped the spurt with an alley-oop from Smith that put the Knicks up 54-38.
Anthony added two 3-pointers to extend New York's lead to 74-50 with 6:17 remaining in the third quarter, slapping his headband with his fingers as he backpedaled on defense each time.
Smith squashed Sacramento's final rally by making all three of his 3-point attempts in the fourth, moving the Knicks' playoffs hopes back in the right direction.
''I've been to [the playoffs] the last four or five years now, and to be home watching it on TV is not going to be any fun,'' Woodson said. ''So I'm desperately pushing these guys to try and get `em in there, because then a new season starts and anything is possible.''
The teams split the two-game season series, with each winning on the other's home floor. ... The last time the Kings started rookies in the backcourt was when Isaiah Thomas and Jimmer Fredette started in a loss to Houston on April 8, 2012. ... New York's five-game road trip resumes Friday at Phoenix. ... Sacramento begins a three-game trip at Oklahoma City on Friday.