The Spurs held a 10-point lead with 7 minutes remaining, but the Knicks went on a late rush to put together one of the most significant victories to date in the NBA season.
New York is the only unbeaten team left in the league and the Knicks' list of victims includes defending champion Miami in addition to the powerful Spurs.
The Knicks are in the midst of a stretch in which they will play six road contests in a seven-game stretch and they were coming off a win in Orlando on Tuesday. New York will now travel to Memphis to take on a team that has not lost a home game this season.
New York got back in the game with an eight-point run during the middle portion of the fourth quarter and Smith gave the Knicks a 97-95 lead with his 3-pointer.
San Antonio scored only five points during the final 2:50 and three of those came on a shot in the closing seconds by Kawhi Leonard.
Five New York players scored in double figures and they were led by Raymond Felton with 25 points. Smith added 17 and Kidd had 14.
Tony Parker scored 19 points for the Spurs, who suffered only their second loss of the campaign and dropped a game at home for the first time in four outings.