The Mets' J.D. Davis celebrates his three-run home run with...

The Mets' J.D. Davis celebrates his three-run home run with Michael Conforto during the seventh inning of an MLB game against the Marlins at Citi Field on Saturday. Credit: Kathleen Malone-Van Dyke

The Mets on Saturday night played precisely the kind of game they were built for.

The starting pitching was solid. The meat of the batting order flexed its muscles. The end game was relatively spotless. It made for an 8-4 win over the surprising first-place Marlins at Citi Field that ended Miami’s winning streak at six games.

The Mets reached the quarter pole of this truncated season 6-9 but in a position to win a home series for the first time this season on Sunday afternoon in the rubber game of three with Miami (7-2).

Michael Conforto, Pete Alonso and J.D. Davis homered to account for seven of the Mets’ runs. None was more significant than Davis’ blast, a three-run shot into the Mets’ bullpen on the first pitch from reliever Josh Smith in the seventh inning. It broke open a 5-4 game.

“Lately I’ve been a little hesitant on the first pitch,” said Davis, who had a career-high four RBIs and has a 12-game hitting streak. “Over the past couple of days, I’ve been wanting to be a little bit more aggressive .  .  . I was looking to get something to hit out in the outfield or get something elevated. I ended up just squaring it up and driving it to rightfield.”

“[Davis] is so disciplined with his approach .  .  . and does a lot of homework,” manager Luis Rojas said. “He’s been a model for everyone on the team on how to prepare for a game, and he shows it. He sits on a pitch and he gets it and he can do some damage.”

Rookie David Peterson (2-1) turned in his third straight solid appearance, allowing two runs, four hits and three walks with three strikeouts in five innings. With the help of a two-run homer by Conforto in the second, a two-run homer by Alonso in the third and a sacrifice fly by Davis in the fifth, he was able to exit the game with the Mets up 5-2.

That’s where the Mets stumbled into their only tough spot. Jeurys Familia came on for the sixth inning, faced five batters and gave up a single and three walks around a double-play groundout. Drew Smith was summoned into the bases-loaded jam and allowed two to score on Monte Harrison’s bleeding ground ball into right.

After Robert Gsellman — in his season debut — pitched a scoreless top of the seventh, the Mets and Davis got to work. Amed Rosario laced a one-out single to left and Jeff McNeil drew a walk to bring up Davis. Marlins manager Don Mattingly went to the righthanded Josh Smith and Davis launched his first pitch over the fence.

It’s just the third time the Mets have scored eight or more runs.

Dan Castano, a lefthander who hadn’t pitched above Double-A, gave up the home runs to Conforto and Alonso and surrendered five runs (four earned) in 4 1⁄3 innings.

The lefty-swinging Conforto now has three homers, all off lefthanded pitchers. “I know we can’t depend on the homer,’’ he said, “but we’re going to hit them. We’ve got a lot of guys with pop.”

Alonso may have turned the page on a poor start. After 11 games, he was batting .167 with one home run. Over the last four games, he is 5-for-15. His homer — which had an exit velocity of 116 mph and caromed off the wall in front of the leftfield stands — was his first since July 27.

“He’s been wanting to do so good and he finally squared a ball up,” Davis said. “He’s done video, looking back on last year .  .  . He’s really slowed it down. He’s gotten back to his form from last year. You can see him using his legs with that big stride to produce that power .  .  . He’s done a pretty good job of turning the page.”