ATLANTA — Julio Teheran is confident he avoided an injury when he was hit by a line drive on his pitching arm.

Teheran said the arm was sore, but the real pain came in watching from the dugout as the New York Mets rallied for four runs in the eighth inning for a 6-4 win over the Braves after he left the game Friday night.

Teheran and the Braves led 4-0 after five innings before he gave up a two-run homer to Curtis Granderson with two outs in the sixth.

Granderson was the first batter Teheran faced after he was hit on his right forearm by Yoenis Cespedes’ line drive.

“It’s OK. It’s a little bit sore,” Teheran said. “Good thing I was able to escape. It got my skin. … I don’t think (the homer) was because I got hit. I just made a mistake.”

Teheran extended his scoreless streak against the Mets to 29 2/3 innings over two seasons before giving up the homer.

The Braves’ youth showed in the decisive eighth.

A fielding error by rookie shortstop Dansby Swanson and two walks from rookie right-hander Mauricio Cabrera (3-1) loaded the bases to set up the Mets’ four-run inning. Kelly Johnson’s pinch-hit double drove in the go-ahead run.

“That’s usually a game we win,” said Braves interim manager Brian Snitker, who pulled Teheran after six innings.

“I was just afraid of that thing tightening up and him trying to want to pitch through it,” Snitker said. “It smacked him pretty good.”

Johnson was traded from Atlanta to the Mets on June 8 and has twice made the Braves pay for the move. His pinch-hit homer in the 11th inning gave the Mets a 1-0 win over Atlanta on June 25.

Johnson said there is “a little bit” of extra satisfaction in delivering big hits against the Braves, who also traded him to the Mets last season.

“It’s just because this is the place you debuted and you come home,” Johnson said. “This was the first team, so you like to come back and kind of show off a little bit and have some success. It’s a little sweeter, I guess.”

Hansel Robles (6-4) worked a scoreless seventh. Jeurys Familia pitched around Adonis Garcia’s leadoff double and a two-out walk to Nick Markakis in the ninth for his major league-leading 48th save. Familia struck out Tyler Flowers to end the game.

Matt Kemp homered and Markakis had a two-run single for last-place Atlanta, which has lost four straight.

The surging Mets have won six straight and lead St. Louis by a half-game for the second NL wild card. They are a half-game behind wild card leader San Francisco, which won 7-6 in 12 innings at Arizona.

STREAKS ON AND OFF

Granderson has homered in four consecutive games, the longest streak of his career. … Freddie Freeman’s fifth-inning single extended his hitting streak to 15 games. Ender Inciarte’s hitting streak ended at 18 games. The two began the night with the longest active streaks in the majors.

TRAINER’S ROOM

Mets: 2B Neil Walker had season-ending back surgery Thursday to repair a herniated disk. Walker announced plans for the operation on Sept. 1. … RHP Jacob deGrom (sore forearm) played catch in the outfield before batting practice but hasn’t thrown off a mound since his last start on Sept. 1.

Braves: Infield prospect Ozzie Albies will undergo surgery next week for a broken right elbow. Albies, 19, was injured while fouling off an inside pitch for Double-A Mississippi. The Braves hope Albies is ready for spring training.

UP NEXT

Mets: RHP Bartolo Colon was moved up one day to start on Saturday instead of Seth Lugo, who had a blister develop in his last start. The blister has popped and Lugo is scheduled to start on Sunday. Colon (13-7, 3.22) is 9-3 with a 2.35 ERA in 13 career starts against the Braves.

Braves: RHP John Gant (1-3, 4.70) will look for his second win overall, and second against the Mets. He allowed only one run and two hits in 6 2/3 innings in a 5-1 win on June 17 at New York, which traded him to the Braves last year.