SAN ANTONIO -- The New York Knicks have struggled this season to look like the team that made it to the second round of the playoffs last season.
On Thursday night, they had a flashback as forward Carmelo Anthony returned to the lineup and guard Iman Shumpert returned to form for a big New York win.
Anthony had 27 points and 12 rebounds in the Knicks' 105-101 win over the San Antonio Spurs.
Anthony, who missed the past three games with sprained right ankle, was 10 of 20 from the field in 38 minutes.
"Ah man, I tweaked it a little bit with six seconds on the clock," Anthony said of his injured ankle. "I'll be all right."
It didn't seem to affect him or his teammates.
New York (10-21) came into the game with the second-worst record in the league but shot 51 percent from the field and 53 percent behind the arc. They also connected on 18 of 20 free throws.
"Everybody played extremely well tonight and everybody played their part," Anthony said. "Everybody played hard. The effort level was very high, the energy was very high. We played like we wanted this game for 48 minutes."
The Knicks got a career-high 27 points from Shumpert and 10 from center Andrea Bargnani. Forward Amare Stoudemire added 11 and center Tyson Chandler 10.
The Spurs trailed throughout the second half until center Tim Duncan's layup made it 98-96 with 2:02 remaining.
The Knicks, who had built a 11-point lead, took the lead back on a Shumpert putback that made it 103-101 with 23 seconds left.
"He saved us. He saved the day, man," Anthony said of Shumpert's play. "Some big-time rebounds, some putbacks. He was back to the old Shump (Shumpert) that we fell in love with. Just his effort tonight, it boosted everybody's confidence. Boosted his confidence. Helped us win the game."
Spurs guard Marco Belinelli tried to answer with another 3-point attempt with 14 seconds left, but the shot bounced off the rim and Knicks forward J.R. Smith grabbed the rebound.
Anthony then hit two free throw to ice the game for the struggling Knicks.
Belinelli had a career-high 32 points to led San Antonio (25-8). He was 12 of 16 from the field and made six 3-point shots.
"I don't really care," Belinelli said of his offensive performance. "When we lose the game, especially like this, I don't really care about my points. It was important to me to win the game. We made crazy mistakes on offense and defense. I made a mistake and we lost the game."
Guards Tony Parker had 12 points and Manu Ginobili added 11 points and 12 assists as the Spurs suffered their first loss to a sub-.500 team this season.
It didn't look that way early for San Antonio when Ginobili connected on a 3-pointer with eight minutes left in the second quarter for a 38-29 Spurs lead. San Antonio hit 8 of 10 from beyond the 3-point line. From that point on, they went 1 of 7 behind the arc and ended the half with 10 turnovers.
They finished the game 14 of 32 from 3-point land.
"Well, I don't think the threes ... well, they have something to do with it," Spurs coach Gregg Popovich said on the loss. "I thought they (New York) were much more physical than we were and you know most of the physical, aggressive teams are going to win in the NBA. That's just the way it is.
"I thought we were very poor in that area. We should be embarrassed about how soft we played tonight."
New York, coming off four days' rest, got 30 first-half points from Anthony and Shumpert to go up 52-47 at the half.
The Knicks led the Spurs 26-25 after one quarter behind Shumpert's 11 points.
The teams split the season series 1-1.
NOTES: Though the New York Knicks got F Carmelo Anthony back, they still have key players on the injured list. PG Raymond Felton (groin) was on the bench, and SF Metta World Peace (left knee) and PG Pablo Prigioni (right toe) did not travel with the team. ... San Antonio was 6-0 and averaging 112.3 points per game against Atlantic Division opponents. ... This was the opener of a three-game Texas swing for the Knicks. After playing San Antonio, they face Houston on Friday and Dallas on Sunday. ... San Antonio has a 57-9 home record when F Tim Duncan, G Tony Parker and G Manu Ginobili all score 15 points or more.