ATLANTA (AP) — Things are looking up for the Atlanta Braves. After being swept at home by the Cardinals, they moved closer to the playoffs by taking an important win over their closest pursuer.

Even better, some players who could play key roles on Atlanta’s postseason roster looked playoff-ready.

Luca Duda’s pinch-hit double drove in the go-ahead run in the seventh, and the Braves beat the Philadelphia Phillies 8-3 on Thursday night to move within reach of their first NL East title in five years.

Atlanta leads the second-place Phillies by 6 1/2 games following the opening game of the four-game series. The teams close the season with three games at Philadelphia, but the Phillies need to win at least three of four in Atlanta to retain hope of making the final series meaningful.

The Braves have a magic number of four over Philadelphia to clinch their first division title since 2013. Following the Mets’ 5-4 win over Washington, Atlanta needs to win only two of the remaining three games in the series to clinch the division.

“It’s fun; these games mean a lot,” said Kevin Gausman, who allowed three runs in 6 1/3 innings, adding another strong start to his case to be included in the postseason rotation.

Philadelphia manager Gabe Kapler didn’t want to talk about now having to win three straight over the Braves.

“I don’t think we think about that right now,” Kapler said. “The most important thing is we did not execute winning tonight’s ballgame. That puts us in a position where we need to come out and win tomorrow’s ballgame.”

Freddie Freeman had two hits and scored two runs. He has eight hits in his last three games.

Tommy Hunter (4-4), the Phillies’ fifth pitcher, gave up a leadoff double to Dansby Swanson in the seventh. The left-handed hitting Duda pulled the run-scoring double into the right-field corner, giving Atlanta the 4-3 lead.

The Braves pulled away with four runs in the eighth.

Swanson, who had two hits, drew a bases-loaded walk from Luis Garcia in the eighth to force in a run. Pinch-hitter Charlie Culberson and Ronald Acuna Jr. drove in runs with back-to-back fly balls off Austin Davis, the Phillies’ eighth pitcher, and Ender Inciarte added a run-scoring single.

Garcia gave up four runs without recording an out.

Kapler said he would have used Hector Neris or Seranthony Dominguez instead of Garcia, whose ERA rose to 5.77, if the game had been tied.

Jesse Biddle (6-1), the Phillies’ 2010 first-round pick, gave up one hit while recording two outs in the seventh.

Vince Velasquez, who began the night 0-4 with a 7.41 ERA in his first four starts against Atlanta this season, allowed three runs on five hits in three innings.

The Phillies scored two runs on three hits, including RBI singles by Odubel Herrera and Jorge Alfaro, in the third.

TRAINER’S ROOM

Kapler said SS J.P. Crawford’s shoulder was “a little sore.” He said Crawford felt better hitting than playing in the field, and his status contributed to a lineup that included Asdrubal Cabrera at shortstop and Carlos Santana at third base. 3B Maikel Franco (shoulder) was available off the bench.

DOUBLE-GUESSING DEFENSE

Atlanta had runners on first and third with one out in the first when Phillies first baseman Rhys Hoskins fielded a grounder by Johan Camargo. Instead of immediately throwing to second base, Hoskins stepped on the bag at first . That enabled Atlanta’s Nick Markakis, who had been on first, to force a long run-down sequence while Freeman scored from third for a 2-1 lead.

Hoskins’ obvious disappointment on the field showed he regretted his decision. Kapler acknowledged “the run is important” but defended Hoskins. “It’s a judgment play and we trust Rhys,” he said.

Kapler did say he thought left fielder Aaron Altherr should have more aggressively charged a hit Swanson turned into a double in the seventh.

RELIEF FOR OCTOBER

Two Atlanta relievers also had important outings. Arodys Vizcaino, the former Atlanta closer who came off the disabled list on Sept. 14 after missing 55 games with right shoulder inflammation, threw a perfect eighth inning. Chad Sobotka, a 6-foot-7 rookie right-hander, struck out the side in the ninth.

“That’s huge,” said Braves manager Brian Snitker, referring to possible added depth in the team’s postseason bullpen that could be provided by the right-handers.

UP NEXT

Phillies: RHP Nick Pivetta (7-13, 4.67) will start in Friday night’s second game of the four-game series. Pivetta is 1-1 with a 3.43 ERA in four starts against Atlanta this season. For his career, he’s 4-1 with a 2.84 ERA against the Braves.

Braves: RHP Julio Teheran (9-8, 3.97) is 1-0 with a 4.91 ERA in three starts against the Phillies this season.