Duncan had 31 points - also a season best - to go along with 18 rebounds for the Spurs, who closed a 15-point lead to three with 3:38 left before the Nuggets closed it out for their third straight win.
Manu Ginobili scored 16 points for the Spurs, who have lost four of their last five.
San Antonio trailed 98-83 before charging back. Patty Mills hit two 3-pointers, Duncan scored eight points and Tony Parker hit a 3 to pull the Spurs to 105-102.
Gallinari responded with a 3-pointer from the wing and Andre Miller hit a floater to stretch the lead to 110-102 a minute later.
Two free throws by Duncan and a basket by Ginobili made it 110-106 with 53 seconds left. A turnover by Denver gave the Spurs a chance to get closer but they missed three straight 3-pointers in the final 24 seconds.
Kenneth Faried had 19 points and 11 rebounds for Denver.
The Spurs trailed 82-69 late in the third quarter when they started fouling JaVale McGee to put him on the line. The strategy appeared to pay off when McGee made just 2 of 8 free throws but San Antonio missed five shots and Denver was able to take a 90-75 lead into the fourth.
Faried opened the second half with a three-point play, Gallinari drained a long 3-pointer and Lawson hit a 16-footer to put Denver up 63-50. The lead grew to 17 on a steal and layup by Ty Lawson midway through the third.
The Nuggets used an 11-4 run to close out the first half and take a 55-48 lead at the break. Gallinari had 11 points and Faried and Corey Brewer had 10 each to pace Denver in the first half.
The Nuggets could have enjoyed a bigger lead but 10 turnovers led to 10 points for San Antonio. The Spurs were also 6 for 12 from 3-point range in the first half.
Duncan led the Spurs with 13 points and was a rebound shy of having a double-double in the first half.
NOTES: Duncan also tied a season high with six assists. ... The Spurs and Nuggets have played a combined 35 road games and 18 home games so far this season. ... Duncan's double-double was his 14th of the season. ... Nuggets F Anthony Randolph was inactive with a sinus infection.
(Copyright 2012 The Associated Press. All RIghts Reserved)