Leonard on Monday had five points in a key stretch in the fourth quarter as the Spurs sent the Heat to their fifth consecutive loss in front of a crowd of 18,400.
The Spurs led 86-81 with 2:22 to play after seven consecutive points in a minute-and-a-half span by the Heat's Dion Waiters.
But Leonard hit a free throw, reserve guard Patty Mills added two more free throws, and forward LaMarcus Aldridge grabbed a key offensive rebound to power the Spurs to a rare home victory.
The Spurs have struggled at the AT&T Center this year, losing their first three home games of November.
San Antonio made five of its six free throw attempts in the final minute.
"Miami is a team that gets after it -- they play physical; that's their style," Spurs center Pau Gasol said.
"You have to play through contact. You have to know who you're playing against and adapt and match their aggressiveness and try to hurt them with execution.
"They did their job and we did ours, and we won."
Aldridge added 18 points and Gasol tallied 12 for San Antonio, who committed a season-high 17 turnovers. Guard Tony Parker posted 11 points and Mills added 10 as the Spurs improved to 8-3 on the season.
"We lost focus in the third quarter with eight turnovers -- their pressure was good and we didn't react to it very well," Spurs coach Gregg Popovich said.
"We tried to dribble too much, the ball didn't move around, and Miami got back in the game."
The struggling Heat dropped to 2-7 on the season. Miami was led by Waiters' 27 points while center Hassan Whiteside had 23 points and 17 rebounds and reserve guard Tyler Johnson scored 11.
"I'm just trying to be aggressive, just trying to lead out there and pick up the energy," Waiters said. "We were right there, but we just couldn't find ways at the end.
"We're making mental mistakes that we can't afford from a young team."
Miami again played without point guard Goran Dragic, who has missed the past two games after spraining his ankle on October 10 against the Chicago Bulls.
The Spurs led 55-40 at halftime, with Aldridge leading the way with all 18 of his points by the half and Leonard racking up 13 before the intermission.
In Houston, a red-hot James Harden flirted with a third consecutive triple-double and the Houston Rockets routed the Philadelphia 76ers 115-88.
Harden tallied 33 points, seven rebounds and nine assists in just 34 minutes for the Rockets, who led by as many as 29 points.
Trevor Ariza added 17 points, and Eric Gordon had 16.
Philadelphia center Joel Embiid made his first road start of the season and posted a double-double of 13 points and 10 rebounds.
Fellow rookie Dario Saric chipped in 11 points as five 76ers scored in double figures
In New York, Kristaps Porzingis recorded his first double-double of the season with 24 points and 11 rebounds as the New York Knicks beat the Dallas Mavericks 93-77.
Carmelo Anthony also finished with 24 points as the Knicks snapped a five-game losing streak to the Mavericks.