Duncan had 31 points -- also a season best -- to go along with 18 rebounds, six assists and five blocks 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.
"We lost control of the tempo of the game but thank God we didn't lose the game," Nuggets coach George Karl said.
Lost in the setback was a milestone night for Duncan. The forward from Wake Forest eclipsed the 23,000-point mark for his career with two free throws with 9 minutes left in the third quarter.
He joined Michael Jordan as the only players in NBA history who went to colleges that were in the Atlantic Coast Conference to score at least 23,000 points.
Manu Ginobili scored 16 points for the Spurs, who have lost four of their last five. All four losses have come in both games of back-to-backs including a loss Monday to the Western Conference-leading Oklahoma City Thunder.
"I couldn't be more proud of the effort," Spurs coach Gregg Popovich said. "It's been a tough month-and-a-half. We asked them to dig down deep and they did."
It took a while but the Spurs did find some rhythm. San Antonio trailed 98-83 before charging back. Patty Mills, who had 15 points, 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 -- his second in a span of 1:37 -- and Andre Miller hit a floater to stretch the lead to 110-102 a minute later.
"Gallinari just ripped our hearts out with those two 3s," Popovich said. "On the one, Boris (Diaw) contested him better than anybody could possibly contest him and he just drilled that sucker. Making shots at the end of the game often wins games and Gallinari did it."
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 despite being sick.
"A grind, yes," he said. "Top to bottom grind. I kept fighting, but it was so hard to produce like I could have. Looking at the numbers, everybody would say I did pretty good. Personally, I believe I can do even better if I was healthy."
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.
"We were playing so well at that time I think it was a momentum thing rather than an advantage thing," Karl said. "We stopped running and stopped getting into the open court."
McGee wasn't bothered by strategy.
"I didn't feel anything about it I just felt I should have hit my free throws," he said. "If I would have made my free throws we probably would have had to close the game."
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.
Kosta Koufos tied a career high with 14 rebounds. ... 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.
Sacramento Kings exercising third-year option on Tyrese Haliburton, source says
The Sacramento Kings are exercising the third-year option on guard Tyrese Haliburton, a source told ESPN's Adrian Wojnarowski.
Fantasy basketball injury outlooks: Kawhi Leonard, Klay Thompson, and more
When should you draft stars like Kawhi Leonard, Jamal Murray and Klay Thompson? Andre Snellings and Stephania Bell break down what we know so far about key players looking to return to the court.
Ben Simmons eligible to rejoin Philadelphia 76ers, won't play in preseason finale
Ben Simmons is "reconditioning" and did not travel with the 76ers to Detroit for Friday's preseason finale. He has cleared NBA health and safety protocols and is eligible to rejoin the team.