"He made some savvy plays to finish some buckets around the rim, took his time," Kings coach Dave Joerger said about Barnes. "That's good for us as we grow because we are a bit frantic at times with our youth. That can be very steady for us."

Harry Giles added 17 points for the Kings before getting ejected. Hield had seven assists and six rebounds to help them end a three-game losing streak. Sacramento remained three games behind San Antonio for the final playoff spot in the West.

Barnes' scoring output was his highest in eight games since being acquired from Dallas at the trade deadline. He has three double-doubles during that stretch, including consecutives ones against the Clippers and Knicks.

"When I first got here I always said the guys we have here are good guys," Barnes said. "It's easy to get along with the team off the floor. When you can have a good relationship off the floor, it makes it easier on the floor."

Alonzo Trier scored 29 points in 30 minutes off the bench for New York (13-51), which was mathematically eliminated from playoff contention with 18 games remaining. Dennis Smith Jr. added 18 points but the Knicks have lost 22 of 25.

"It was a lot of stoppage of play and the game was choppy because of how many fouls were being called," Trier said. "It was tough to find a rhythm, but those are the things you have to play through in this league. There are going to be nights when it's like that."

Sacramento led by 14 midway through the fourth quarter before New York surged behind Trier and pulled to 100-92 with 6 1/2 minutes left. Hield dunked off an offensive rebound, then made a 3-pointer after Luke Kornet hit a free throw for the Knicks.

Kornet drained a 3 but Willie Cauley-Stein scored on an alley-oop dunk and made three free throws after New York intentionally fouled him twice.

"A win is a win at this point in the season, you don't care how you get them," Kings guard De'Aaron Fox said. "We didn't make the shots that we usually make but we were able to get them to turn the ball over. They usually don't do that."

There was an added security presence around Golden1 Center before the game due to protesters who were marching in city streets, two days after a Sacramento district attorney declined to bring chargers against two officers involved in the fatal shooting of Stephon Clark in March 2017. Clark, a 22-year-old unarmed black man, was shot after a chase that ended in his grandparents' backyard.

Perimeter barriers were set up around the arena and an adjacent plaza was closed, with only ticketed fans and people with credentials being allowed inside. No incidents were reported near the venue.

That was in contrast to last year when hundreds of people locked arms surrounding the arena, preventing fans from entering two games in protest of the police shooting.

TIP-INS

Knicks: Reached double figures in 3-pointers (12) for the 35th time this season. ... Lance Thomas had five points in 16 minutes, one night after going scoreless for the first time since Dec. 17.

Kings: Made 26 of 33 free throws. . Sacramento is 23-3 when leading going into the fourth quarter. . Hield tied his career high for assists.

RILED GILES

Giles was ejected with 5:07 left after being called for a Flagrant 2 penalty when he appeared to elbow Kornet in the head. Giles waved his arms while exiting to a loud ovation. Joerger later praised his rookie big man, who shot 7 of 9 and had seven rebounds. "It's fun to watch the young guys getting better and better," Joerger said. "Don't wait for a couple years to watch us because the journey's going to be fun. That's one example, watching him get better right in front of your eyes."

UP NEXT

Knicks: Play at Phoenix on Wednesday. New York fell just behind the Suns (14-51) for the worst record in the league when Phoenix stunned the NBA-best Milwaukee Bucks on Monday night.