BOSTON — The injury to free agent Gordon Hayward devastated the Boston Celtics emotionally and threatened to derail their efforts to improve on last year’s Eastern Conference finals appearance.

It took about three games for them to figure things out.

“Once that happened, we really didn’t know where we were at as a team,” center Al Horford said on Monday night after the Celtics won their fifth straight game, beating the San Antonio Spurs 108-9. “We’ve really come together.”

Kyrie Irving scored 24 points for the third straight game, Jaylen Brown added 18 and Horford had 13 rebounds for Boston, which last beat the Spurs in 2011 — a 10-game losing streak. Irving also had three steals and a blocked shot, and coach Brad Stevens praised his defense.

“You can tell he’s getting more comfortable every time he takes the floor,” Stevens said.

Boston signed Hayward in the offseason in an attempt to bolster the team that earned the No. 1 seed in the East. But the deal that swapped Irving for Isaiah Thomas signaled a near-complete break with last year’s team.

Then Hayward was injured before the season was six minutes old, and the Celtics lost their first two games, on back-to-back nights.

Since then, they haven’t lost.

And Irving is the biggest reason why.

“Things were going rough for him at the beginning of the season. A lot of people doubted him,” said guard Terry Rozier, who had 10 of his 12 points in the fourth quarter. “I feel like we all had to adapt to him. It’s worked out pretty well.”

Reserves Brandon Paul had 18 points and Rudy Gay scored 14 for San Antonio.

It was the first game this season that LaMarcus Aldridge didn’t lead San Antonio in scoring. He had 11 points.

Boston led 54-49 at halftime and scored 10 of the first 12 points in the third quarter — eight from Irving on a pair of 3-pointers and a layup. The Celtics point guard was 10 for 15 shooting through three quarters, including 3 for 6 from 3-point range, before sitting most of the fourth while Boston nursed a double-digit lead.

“No different than any other night I’ve seen him play,” coach Gregg Popovich said. “He’s a hell of a player. You think that’s going to change? Kyrie does what he does and he does it very well.”

MISSING

San Antonio remains without Tony Parker (left quad) and Kawhi Leonard (right quad), and Popovich rested Manu Ginobili as the Spurs lost on back-to-back nights and fell to 1-3 on a four-game road trip.

“I rested him,” Popovich said, adding jokingly, “That’s something I never do.”

SPURTS

Rozier scored 10 of the Celtics’ first 13 points in the fourth quarter, eight of them in a 52-second span when Boston turned an 11-point lead into a 93-74 rout. Rozier made just one of his first nine shots before making four in a row in the fourth.

TIP-INS

Spurs: Made a 3-pointer for the 982nd consecutive game. … Popovich was left waiting for career victory No. 1,155, which would tie him with Phil Jackson at sixth on the NBA’s all-time list. … Popovich’s next road win will be his 500th, something just three coaches in NBA history have achieved.

Celtics: Irving’s 128 points in his first six games as a Celtic were the most since Kevin Garnett and Ray Allen each had 131 in 2007. … Marcus Morris practiced with the developmental league team on Monday and will rejoin the Celtics on Tuesday. Coach Brad Stevens said his right knee has “really, really improved.”

UP NEXT

Spurs: Host Golden State on Thursday.

Celtics: Host Sacramento on Wednesday.