Duncan wound up with 20 points and 11 rebounds for the Spurs after missing the first seven shots he took in the game.
He took a pass from Tony Parker in the dying seconds and sank the winning basket moments before the final horn sounded.
His shot completed a Spurs comeback, as San Antonio out-scored Cleveland 30-22 in the fourth quarter.
Parker had 19 points, 10 assists and eight rebounds for the Spurs, who handed the Cavaliers their third straight loss.
Manu Ginobili added 17 points for the Spurs, but missed a pair of free throws with 19.2 seconds left that could have given the Cavs a four-point lead.
Zydrunas Ilgauskas scored 26 points for the Cavaliers, including a game-tying dunk with 14.2 seconds remaining after Ginobili missed his free throws.
LeBron James wound up with 20 points, eight rebounds and seven assists for Cleveland, losers of four of its last five games.
The game marked the end of Gordon Gund's 22-year run as owner of the Cavaliers. Detroit businessman Dan Gilbert takes over the team onTuesday, with Gund becoming a minority owner.
San Antonio improved to an NBA-best 43-13, a half game ahead of Phoenix in the overall NBA standings.
In other games, Tim Thomas scored a season-high 35 points to lead the Knicks past the Los Angeles Lakers 117-115 in overtime in New York.
The Knicks blew a 10-point lead in the final 46 seconds of regulation, but recovered to win their third straight game.
Michael Sweetney had 19 points and 12 rebounds for New York.
Kobe Bryant led the Lakers with 30 points and eight assists, while Lamar Odom added 26 points and 15 rebounds.
Los Angeles has lost three straight games.
In Dallas, Dirk Nowitzki had 28 points and 11 rebounds as the Mavericks got by the New Orleans Hornets 90-86.
Marquis Daniels added 13 points for the Mavericks.
Lee Nailon led New Orleans with 14 points, while P.J. Brown added 12 points and 14 rebounds.
In Salt Lake City, Keith McLeod had 18 points and eight assists as the Utah Jazz edged the Los Angeles Clippers 87-86.
Raja Bell added 14 points for the Jazz.
Bobby Simmons had 17 points to lead the Clippers.