It took a lot of hard work for the Hawks to take homecourt advantage away from the Magic in their first-round Eastern Conference playoff series.

They nearly gave it back with several mistakes in the final moments of Game 4 on Sunday night before finally putting away the Magic.

Guard Joe Johnson made four free throws in the final 20.2 seconds to secure Atlanta's 88-85 victory over Orlando at Philips Arena. The Hawks can win the best-of-seven series with a victory at Orlando on Tuesday.

Jamal Crawford scored a team-high 25 points and Johnson had 20 for the Hawks.

The lower-seeded Hawks nullified the Magic's home-court advantage with a victory at Orlando in the series opener. The Magic nearly got it back with a furious second-half rally behind Dwight Howard (29 points) and Gilbert Arenas (20).

The Hawks led 54-41 early in the second half but Arenas' 3-pointer tied at 68-68 early in the fourth. Baskets by Crawford and Al Horford gave the Hawks a 75-70 lead, and two baskets and two free throws by Howard tied it at 76-76 before Atlanta surged ahead with an 8-1 run.

Hawks forward Josh Smith scored on a hook shot and, after Howard missed two free throws, Johnson made a floater over Howard. Hawks center Jason Collins drew a charging call on Hedo Turkoglu and Johnson made two free throws for an 82-76 lead.

After Howard made 1 of 2 free throws with 1:56 left, Johnson scored on a drive to the basket. The Magic made one last comeback attempt when Nelson scored on a drive and then stole the ball from Johnson and passed to Quentin Richardson for a dunk that cut the lead to 84-81 with 1:04 to go.

A poor possession by the Hawks led to a shot-clock violation and a blown defensive assignment allowed Arenas score and pull Orlando within 84-83. The Magic fouled Johnson, who made two free throws to make it 86-83 with 20.2 seconds remaining.

Howard rebounded Arenas' miss and scored with 12.4 seconds to go. Johnson made two more free throws before Turkoglu missed a rushed 3-pointer before the final buzzer.

The Hawks had to hang on to win a game they controlled early.

The Hawks ran out to a 37-23 lead by making 16 of their first 26 field-goal attempts. They gave most of that advantage back with a ragged end to the second quarter.

After Collins went to the bench with his fourth foul in the third quarter, Howard went to work against Hilton Armstrong. He scored seven of his 13 points in the period against Armstrong, who was forced into a bigger because of Zaza Pachulia's suspension.

Arenas had played just eight minutes in the previous three games of the series but he joined Orlando's guard rotation with Jason Richardson suspended for his Game 3 scuffle with Pachulia. Orlando trailed 63-54 late in the third quarter when Arenas scored five points to help trim the lead to 66-61 at the end of the period.