San Antonio jumped into the third spot in the Western Conference and Houston dropped from third to sixth.
The Spurs had a four-point lead when Harden made a layup for his first points of the half with less than 90 seconds remaining.
Duncan missed a layup before Harden made a three-pointer with 28.9 seconds left to get Houston to 104-103. Tony Parker turned it over to give Houston one last shot.
But Duncan blocked Harden's shot and grabbed the rebound to secure the victory.
The close game ended a streak of nine straight wins by at least 12 points, which had tied an NBA record.
Harden, who entered the game leading the NBA in scoring, had just 16 points as San Antonio Coach Gregg Popovich kept the ball out of Harden's hands by intentionally fouling Josh Smith 12 times in the second half. Smith went 12 for 26 from the line and led the Rockets with 20 points.
at Atlanta 104, Charlotte 80: Mike Muscala scored 17 points, and the Hawks beat the Hornets to reach 60 wins for the first time in franchise history. The Hornets were eliminated from the playoff race with their third straight loss, combined with wins by Indiana and Boston.
at New Orleans 90, Phoenix 75: Anthony Davis had 19 points and nine rebounds to lead the Pelicans to a victory over the Suns. Davis' night nearly ended early after getting tangled near the basket with the Suns' Earl Barron, whose elbow struck the New Orleans forward below the chin in the second quarter. Davis was hunched over with his hands clasping his throat before slowly walked off the court and into the home locker room. He returned in the fourth to a rousing ovation and had six points and five rebounds in the final 11 minutes.
at Oklahoma City 116, Sacramento 103: Russell Westbrook scored 27 points and handed out 10 assists as the Thunder held off the Kings to remain even with New Orleans for the final playoff spot in the Western Conference.
at Brooklyn 117, Washington 80: Brook Lopez scored 26 points, Bojan Bogdanovic added 22, hitting all six of his three-point attempts, and the Nets continued their playoff push with a blowout of the Wizards.
Dallas 144, at Denver 143 (2OT): Raymond Felton hit a layup with 1.5 seconds remaining in double overtime, then blocked a last-second shot to help the Mavericks beat the Nuggets. Felton drove past Randy Foye and banked in a shot high off the glass. He then got a piece of Kenneth Faried's jumper at the buzzer, causing the ball to wind up short.
Boston 99, at Cleveland 90: Marcus Smart scored 19 points, and the Celtics maintained their grip on a playoff spot by holding off the short-handed Cavaliers. The Cavaliers played without injured All-Star Kyrie Irving and used their reserves extensively after clinching the No. 2 seed in the East on Wednesday. They had won 18 consecutive home games.
Milwaukee 99, at New York 91: Giannis Antetokounmpo returned to the lineup with 23 points and moved the Bucks to the verge of a playoff spot with a victory over the Knicks. The Bucks lowered their magic number to one for clinching a playoff berth, which would complete a remarkable turnaround from an NBA-worst 15-67 record last season. They would have secured a place in the postseason with losses by Boston, Brooklyn or Indiana, but all three won Friday.
at Lakers 106, Minnesota 98