MIAMI (AP) -- Gio Gonzalez had some worrisome moments on the mound Tuesday night, including when a friend sitting in the first row behind the Washington Nationals' dugout was hit in the head by a flying bat.
"Next time in the front row everyone will be wearing a helmet," Gonzalez said.
The friend later said he was fine, and Gonzalez felt good too after pitching seven innings to beat the Miami Marlins 12-3.
Gonzalez (7-1) allowed three runs, including two on Marcell Ozuna's 19th homer , but struck out eight and won his fourth consecutive decision.
"Exactly what we needed," manager Dusty Baker said. "Gio's throwing the ball great."
He had plenty of support even before a five-run ninth. Bryce Harper started the scoring with a two-run single that extended his hitting streak to 13 games, and Daniel Murphy had two RBIs and hit his 12th homer. Stephen Drew had three hits and three RBIs, while Ryan Zimmerman drove in three runs with a double and a single.
Gonzalez, who grew up in nearby Hialeah, improved to 7-3 in 13 starts against his hometown team with an ERA of 2.19. He had a cluster of friends and relatives in attendance, and that's where Justin Bour's bat went when it slipped from his hands on a swing in the fifth inning.
"It's good to have friends here, but put them somewhere safe," Gonzalez said.
He said his pal who was hit received a souvenir later as compensation for being clubbed.
"Bour gave him a bat, which is pretty cool on his part, because we want the fans to come back," Gonzalez said.
The left-hander said it was too early to talk about the possibility of pitching in the All-Star game, which will be played in his hometown next month. His teammates are rooting for it.
"Gio has been great," Harper said. "I'm hoping he pitches like this the rest of the first half and gets the start here. It would be incredible to see."
The NL East leaders went 7 for 14 with runners in scoring position, but it was still 0-0 when Edinson Volquez (3-8) walked Michael A. Taylor and Trea Turner in the third inning, and they advanced on a double steal.
With two outs, Harper tried to bunt on the first pitch -- a curious move by the slugger -- and pushed it foul. He golfed the next pitch into center for the Nationals' first hit to put them up 2-0.
"I don't hit Volquez very well," Harper said. "If I can lay a bunt down with a guy at third and get a knock and score a run … but it worked out."
Pitching to Harper backfired for Miami, so the next time he came to bat, when the Nationals again had a runner in scoring position, Marlins manager Don Mattingly opted for an intentional walk. Zimmerman foiled the strategy with a two-run double.
"They've got a good lineup," Mattingly said. "They put you in a box in a number of ways."
Volquez allowed a season-high six runs in 4 2/3 innings.
When someone brought up Harper's hitting streak, he feigned a grimace.
"I'll probably go 0 for 4 tomorrow. I appreciate that," he said. "Nah, I'm just trying to have good at-bats, and good things will happen."
The streak is the longest of Harper's career in a single season.
Ozuna ran through a stop sign to score Miami's first run. Ozuna reached on a single in the fourth and came around on a double by J.T. Realmuto, ignoring third-base coach Fredi Gonzalez's signal to hold at third and easily beating the throw home.
As the Marlins celebrated, Gonzalez looked into their dugout with a sheepish shrug.
Nationals: Drew replaced 3B Anthony Rendon (sore neck), who was held out of the lineup but was available in an emergency.
Nationals RHP Max Scherzer (8-4, 2.26) is scheduled to face RHP Dan Straily (5-4, 3.58) in the rubber game of the series Wednesday afternoon. Scherzer has at least 10 strikeouts in each of his past five starts, and he leads the NL in ERA and strikeouts.