The Boston Celtics looked dead and buried during the first half of Thursday’s tilt with the Houston Rockets at TD Garden.

Boston trailed by 24 at halftime, playing very much like a team on the second night of a back-to-back facing an NBA Finals contender coming off two days rest.

But the Celtics woke up at halftime, clamping down on the Rockets’ lethal 3-point shooting attack and using their defense to create offense during a 20-4 run in the third quarter.

Despite Boston’s best effort, it appeared they would fall to the Rockets, with Houston leading by three with 13 seconds to play.

But the Celtics never say die.

Marcus Smart found Jayson Tatum for a dunk to cut it to one, and Boston immediately got the ball back when James Harden was whistled for an offensive foul.

On the ensuing possession, Al Horford got the ball in the post, turned over his left shoulder and buried a hook shot to give the C’s the lead and an eventual 99-98 win.

Kyrie Irving led the Celtics with 26 points, while Harden led all scorers with 34.

With the win, the Celtics improved 29-10, while the Rockets fell to 25-8.

Here’s how it all went down:

PG: Kyrie Irving
SG: Marcus Smart
SF: Jayson Tatum
PF: Al Horford
C: Aron Baynes

The Rockets jumped on the Celtics early. Houston opened the game on a 12-0 run, shooting 5-for-7 from the field, forcing Brad Stevens to take an early timeout.

The stoppage didn’t help the C’s, though, as the Rockets continued to hammer Boston en route to a 32-12 lead after one quarter. Boston shot just 5-for-19 from the floor in the first while going 2-for-7 from 3-point land and committing eight turnovers. The C’s did not shoot a free throw in the stanza.

Houston shot 44 percent from the floor and 40 percent from long distance in a dominant first quarter.

Harden led all scorers with 10 points, while Horford led the C’s with three points.

The Celtics were unable to chip into the Rockets’ lead in the second quarter. Houston shot 47.7 percent in the half and hit 10 3-pointers to take a 62-38 advantage into the locker room, with the C’s turning the ball over 12 times, shooting a lowly 38.9 percent from the field in the half.

Harden and Eric Gordon almost outscored Boston by themselves, pouring in 17 first-half points apiece, while Trevor Ariza added nine and Ryan Anderson chipped in with eight. Irving paced the C’s with 11 points and Tatum scored 10, but that was all the Celtics could manage on offense.

Despite an atrocious first-half performance, the Celtics made it a game in the second half. Trailing by 25 with 7:40 to play in the third period, the Celtics went on a 20-4 run to cut the lead to nine with two minutes to play in the quarter. Houston took its foot off the gas, as NBA teams with a huge lead have been known to do, and Boston did a good job of stopping the Rockets from getting back into their flow.

Boston continued to battle, cutting the lead to two with a chance to tie or take the lead with under a minute to go.

However Irving turned the ball over and Boston was forced to foul with 18.7 seconds left. But P.J. Tucker only hit one of two free throws, giving Boston a chance to tie the game. Smart drove past Tarik Black and finished at the rim to cut the lead to one with 13 seconds to play.

Harden would sink the ensuing free throws, but Smart found Tatum for a dunk to cut it back to one, and Boston got the ball back when Harden was called for an offensive foul.

With 3.7 seconds left, Horford buried the hook shot and sent TD Garden into delirium.

Horford for the win.

The Celtics will hit the floor again Sunday when they face the Brooklyn Nets at TD Garden. Tip-off is scheduled for 5:30 p.m. ET.

Thumbnail photo via Greg M. Cooper/USA TODAY Sports