MIAMI - Jose Fernandez is so good at home he can give up four runs in the first inning and still win.

The Miami Marlins ace became the first pitcher in the modern era to win his first 17 career home decisions, overcoming a rough start Friday to beat the Atlanta Braves 12-11.

Fernandez gave up a homer to Nick Markakis to start the game and allowed four runs in a 35-pitch first inning. He tied a career high by allowing six earned runs in five innings.

But the Marlins rallied with four runs in the first, led 11-4 by the fourth inning and totalled 20 hits in the matchup of the majors' two lowest-scoring teams.

"It's a funny way baseball has to wake you up," Fernandez said. "Lucky and blessed is the way I feel right now."

Rookie Justin Bour hit his 20th homer, and Dee Gordon's three hits hiked his average to .332. Christian Yelich came within a homer of hitting for the cycle, and backup catcher Jeff Mathis had four RBIs to increase his season total to 11.

They were glad to help Fernandez become a record-breaker.

"It's awesome," Mathis said. "Any time you do something nobody else has done in this game, it's pretty cool."

Fernandez (6-0) needed the offensive support. He also needed 96 pitches to make it through five innings and qualify for the victory, which made him 17-0 in 26 home starts over his three-year career.

Fernandez took the mound well aware of his opportunity to break the record dating to 1900, which he shared with Johnny Allen (1932-33) and LaMarr Hoyt (1980-82), who won their first 16 home decisions.

"I'm not going to lie — I thought about it," Fernandez said. "A lot of people, a lot of friends told me about it. I was distracted about it. It feels special."

Kyle Barraclough preserved the one-run lead by coming on to retire two batters with the bases loaded in the eighth. A.J. Ramos pitched around a leadoff single in the ninth for his 30th save, while Fernandez watched from the dugout.

"The last two innings I thought I was going to eat my whole finger," he said. "I was pretty nervous."

Fernandez hit 98 mph several times on the radar gun and walked only one. But there were few swings and misses from the Braves, and they reached the right-hander for six runs and nine hits — his highest totals in 10 starts since returning from Tommy John surgery.

His ERA rose from 2.18 to 2.91.

"We battled," Braves manager Fredi Gonzalez said. "When you score four off of Fernandez in the first inning, you feel pretty darn good, because he doesn't give up four in three starts."

Ryan Weber (0-2) allowed seven runs in two-plus innings for the Braves, who fell to 6-1 this year at Marlins Park. They're 56-91 everywhere else.

The Marlins improved to 15-8 since Aug. 31.

Atlanta led after only three pitches from Fernandez when Markakis hit his third homer in 583 at-bats. The next four batters singled, and soon the Braves led 4-0.

Miami quickly answered. The first five batters reached on hits, including Bour, who hit a three-run homer. The Marlins took the lead for good in the third when Mathis greeted reliever Ryan Kelly with a three-run triple.

Freddie Freeman, playing despite a sore right wrist, hit his 18th homer and singled twice for Atlanta.

TRAINER'S ROOM

Marlins: RHP Carter Capps is being shut down for the season and has given up trying to come back from the right elbow strain that has sidelined him since Aug. 2. He felt discomfort in his most recent bullpen session but is expected to be fine for spring training. ... RF Giancarlo Stanton will make a decision in the next couple of days regarding whether to try to play in the final week. He has been sidelined since June 26 with a broken left wrist. ... 3B Martin Prado (left wrist) was back in the lineup after missing six starts.

UP NEXT

Braves RHP Julio Teheran (10-7, 4.20) is scheduled to start Saturday against rookie LHP Justin Nicolino (3-4, 4.50).