Al Horford called it a must-win.

The center made it happen.

It wasn’t easy but the Hawks got a dramatic 88-87 comeback victory over the Mavericks Friday after erasing a 17-point deficit. Horford drained a jumper with 4.2 seconds remaining to complete the improbable rally.

The Hawks (9-8, 5-3 home) snapped a three-game losing streak. The win avenged a season-opening loss to the Mavericks.

The Hawks used a furious fourth-quarter rally. They pulled to within one point, 87-86, with a Paul Millsap straight-on 3-pointer with 1:16 remaining. After the Mavs missed twice and the Hawks once, Horford hit the game-winner.

Jeff Teague led the Hawks with a game-high 25 points, nine in the fourth quarter. Horford added 17 points with Millsap (15) and Lou Williams (12) were the other double-digit scorers.

The Mavericks (10-7, 2-6 road) were led by Jose Calderon, who left in the third quarter with a right ankle injury, and Dirk Nowitzki with 16 points.

The Mavericks led 53-39 at the half thanks to a 16-0 run between the first and second quarters. The Hawks led by five points before going stone cold. They missed all nine shots in a span of 6:42 at the Mavs went on the run. The 11-point advantage would grow to as many as 17 in the first half.

Both teams shot 42.5 percent (17 of 40) through the first two quarters. The difference was the Mavs 3-point and free-throw shooting. The Mavs were 7 of 13 from 3-point range, including 5 of 6 in the first quarter, as the Hawks made just 2 of 9. The Mavs were also 12 of 12 from the free-throw line as the Hawks were 3 of 6.

The Hawks dropped a 118-109 decision at the Mavericks in the season opener. Hawks coach Mike Budenholzer said he believed his team had made progress in the 16 games since the loss.

“I think we’ve made progress in a lot of areas since then,” Budenholzer said before the game. “In any season, there are some ups and downs and some slippage at times. We want to be on top of that and address it and talk about it and improve it. We are in that stage where we need to improve some things. But compared to the start of the season, we are a better team.”

The Hawks continue the run of five games in seven days Saturday at the Wizards. They play at the Spurs Monday. The schedule gets friendly as the Hawks play four straight and seven of eight at home.