For a team that’s had to reinvent itself time and time again this season, the Braves’ offense has found recent solace in the capable – and bare – hands of Evan Gattis.

Gattis revved up the Braves offense for the second straight night against the Marlins, with run-scoring hits in each of his first two at-bats, and held on for a 4-3 win behind the solid work of Julio Teheran.

The Braves, now 2-3 on this trip, reduced their magic number to seven. Any combination of Braves’ wins and Nationals’ losses totaling seven assures the Braves of their first NL East title since 2005.

Gattis doubled in the first inning for his sixth extra-base hit in seven games since his minor-league tune-up. Gattis went 2-for-5 to make him 9-for-26 (.346) with three doubles, three home runs and seven RBIs in seven games in September.

“I just feel back to normal,” Gattis said. “I feel back to attack mode.”

Freddie Freeman and Chris Johnson added two-hits apiece as the Braves offense continued to produce enough runs to complement quality pitching in a 2-0 start to the series.

Teheran settled back in after a 10-game layoff, and a three-run first inning, to shut down the Marlins. He walked off a winner, moving to 12-7 in large part because of the handiwork of reliever Luis Ayala, who struck out Giancarlo Stanton on three pitches to leave the bases loaded in the seventh inning.

“It was the biggest out of the ballgame for us,” Braves manager Fredi Gonzalez said.

The Braves recorded another big out to end the game on a fortuitous bounce off the backstop. Closer Craig Kimbrel had given up a one-out double to Placido Polanco and sent a two-out pitch past Ed Lucas. But catcher Brian McCann fielded the ricochet and threw to third base to get pinch runner Jake Marisnick in a rundown.

“You don’t practice that play in spring training,” Gonzalez said.

Kimbrel walked off with his majors’ leading 46th save and franchise-record 36th in a row. The Braves now lead the season series with the Marlins 12-5, including 7-1 at Marlins Park.

Teheran was pitching for the first time since out-dueling Jose Fernandez on August 30 at Turner Field, taking the extra rest the Braves prescribed before heading into the playoffs.

Teheran gave up two runs in the first inning after allowing a couple of bloop hits to center field, a walk, and a rope down the left field line by Stanton, who doubled in his first at-bat back in the Marlins lineup since Saturday. Then the Marlins took the lead 3-2 on a rare errant throw by Andrelton Simmons on a double-play attempt.

Teheran settled back in, retiring 15 of the next 16 batters he faced until walking Stanton in the sixth.

“The first inning I was feeling a little bit weird after having the long rest,” Teheran said. “But at the same time, I felt fresh and my arm was feeling good. Just one bad inning.”

Teheran gave up only those three first-inning runs in 6 2/3 innings, despite leaving two runners on in the seventh. Luis Avilan hit Christian Yelich with a 2-2 pitch to leave work for Ayala against Stanton.

“I was just trying to throw a strike, working on the corner, try to get a groundball,” Ayala said. “I don’t expect to make a strikeout.”

The Braves scored two runs each in the first and third innings to take an early lead on the Marlins and then regain it after Teheran’s three-run first.

They took a 2-0 lead in the first inning on three consecutive two-out hits, including back-to-back RBI doubles by Gattis and McCann. Then the Braves used back-to-back hits by Justin Upton and Freeman in the third to put runners in scoring position. Gattis and Chris Johnson drove them in to reclaim the lead 4-3.

Upton had to leave Tuesday’s game after fouling a ball off the outside of his right knee in the fourth inning. He was diagnosed with a bruised right knee and is considered day to day.