New York Knicks guard Raymond Felton, center, is double-teamed by Sacramento Kings Francisco Garcia, left and Donte Greene, late in the fourth quarter of an NBA basketball game in Sacramento, Calif., Wednesday, Nov. 17, 2010. The Knicks beat the Kings 113-106.(AP Photo/Rich Pedroncelli)

SACRAMENTO, Calif. (AP) — The way the New York Knicks started the game, it sure appeared as though they were headed for a seventh straight loss.

Then somehow they found their shooting stroke and came through with a much-needed win.

Amar’e Stoudemire and Danilo Gallinari each scored 27 points to help the Knicks overcome a slow start to snap a six-game losing streak with a 113-106 victory over the Sacramento Kings on Wednesday night.

“We felt a little tight obviously when we started — a little lethargic and tight,” coach Mike D’Antoni said. “We got way behind but we fought back. We started making shots and we took off.”

Raymond Felton added 16 points for the Knicks, who were the stronger team down the stretch despite playing for the second straight night. Stoudemire had 10 rebounds, Toney Douglas sparked New York off the bench with 14 points and Gallinari made a career-high 16 foul shots.

It was another rough game for the young Kings, who gave the Knicks far too many open looks and easy points at the foul line in losing their sixth straight overall and fifth in a row at home.

“We mixed in some excellent basketball with some sub-sixth grade basketball,” coach Paul Westphal said. “It was indescribably bad. It’s really hard to find any middle ground for us. We’re looking for some consistency and it didn’t happen tonight.”

After trailing by 15 points early, the Knicks went on a torrid shooting spree to take a 93-81 lead early in the fourth on a long jumper by Douglas. That basket was New York’s 29th in 38 attempts since late in the first quarter — a 76 percent shooting clip that exposed Sacramento’s defensive woes this season.

Little-used Donte Greene then sparked a 9-0 run with a 3-pointer in just his third game since starting the season opener as the Kings closed to 93-90. A dunk by Carl Landry made it a two-point game, but the Knicks responded with a 9-2 run capped by an emphatic one-handed dunk by Stoudemire.

Beno Udrih then scored five quick points for the Kings. But Felton hit a jumper and Tyreke Evans missed a shot and turned the ball over. That ended Sacramento’s hopes at a comeback and gave the Knicks the win a night after losing a close game in Denver.

“We have to get used to this feeling,” Stoudemire said. “Tonight was a night where we showed progress from the Denver game. We played well in that game. Tonight we carried it over. We have to keep this swagger and this mentality and go on to the next one.”

Both teams juggled their lineups in hopes of snapping their skids with the Kings starting Luther Head and Jason Thompson in place of Udrih and Omri Casspi, and the Knicks going with Ronny Turiaf instead of Timofey Mozgov.

The moves appeared to pay off for the Kings early, or it could have just been the effects of the Knicks playing a night after losing in Denver.

New York opened the game shooting 3 for 21 and fell behind by 15 points in the final minute of the first quarter. But the Knicks quickly found their stroke after that, hitting 13 of 17 shots in the second quarter. They took the lead with a 17-2 run early in the second, capped by a 3-pointer by Douglas.

“We knew we could play better,” Stoudemire said. “We didn’t start off well. We didn’t shoot the ball well to start off. We have great confidence of what we can bring to the table. We just stuck with it.”

The Knicks led 54-49 at the break — the 10th straight game this season Sacramento has trailed at the half.

“We have to go back to the drawing board and play better defense,” Landry said. “Defense is what wins games in the NBA. We weren’t playing like a team in the second quarter and lost our focus on defense. The first quarter was fine but the second quarter got away from us.”

Notes: Knicks F Anthony Randolph did not play despite being healthy for the first time this season. “We won. That’s all that matters,” he said. … Thompson got the start two games after not playing at all despite being healthy. … Felton and Stoudemire each got called for technical fouls. … The Knicks were called for travels on successive trips twice in the third quarter. … The Kings already matched last season’s longest home losing streak just six games into their home schedule.