MIAMI — Jorge Alfaro hit a game-ending, two-run double and the Miami Marlins rallied from two deficits in the ninth and 10th innings to beat the San Francisco Giants 7-6 Saturday night.

Corey Dickerson had four hits for the Marlins who have won six of seven. Alfaro’s extra-base hit to win it was his first of the season.

““I just tried to help the team,” said Alfaro, who was hitting .192 before Saturday. “I was looking for a pitch that I could make hard contact.”

San Francisco led 5-3 before RBI singles in the ninth by Alfaro and Starling Marte off Jake McGee. The closer blew his first save in seven opportunities and threw 35 pitches in the inning, retiring Adam Duvall on an inning-ending flyout that stranded the bases loaded.

“It’s still fairly easy to turn the page, I would say it’s always amnesia,” McGee said of his outing. “If you can figure out what went wrong and why it went wrong, you’ll have something to work on towards the next game.”

Brandon Belt’s run-scoring double against Yimi García (2-1) put the Giants ahead 6-5 in the 10th.

Jazz Chisholm walked against Jarlin García (0-1) with one out in the bottom half, joining the the pandemic-rules automatic runner to give Miami two on. Chad Wallach flied out, and Alfaro lined a double that bounced to the left-field wall.

“This is a group that went through a lot last year,” Miami manager Don Mattingly said. “These guys are going to fight. We start the game with confidence.”

Miami starter Sandy Alcantara allowed four runs and six hits in 6 1/3 innings with seven strikeouts.

“Sandy was a little bit of a mystery because he was cruising all day and getting ahead,” Mattingly said. “His pitch count was in a good spot.”

Giants starter Aaron Sanchez gave up one run, five hits, three walks and a hit batter in 4 2/3 innings.

San Francisco catcher Buster Posey was hit on the left elbow by Alcantara’s final pitch. Posey went to first base and scored on a three-run homer by pinch-hitter Austin Slater off Richard Bleier, which capped a five-run inning that put the Giants ahead 5-3. Posey left the game before the bottom half.

The former NL MVP left with a bruise, Giants manager Gabe Kapler said.

Belt homered leading off the seventh, and Brandon Crawford had an RBI single. Belt has reached safely in 28 straight games against Miami.

“I think that’s the type of offence that we’re capable of being and the type that can put up a big inning,” Kapler said. “You win a lot of games when you have big innings. It’s really tough to win one-run ball games. Your pitching has to be excellent.”

Duvall tripled in a run in the first, and Jesús Aguilar made it 3-0 with a two-run double off Matt Wisler in the sixth.

DEPLETED BENCHE:

The late scoring, pinch-runners and the combined use of 11 relievers by both teams resulted in multiple double-switches and eventually depleted benches. Wallach was the last Miami position player available when he pinch hit, and Giants pitcher Anthony DeSclafani pinch-hit in the top of the 10th. DeSclafani’s sacrifice bunt attempt ended in a forceout at second.

TRAINER’S ROOM

Giants: RHP Tyler Beede (elbow surgery) and RHP John Brebbia (elbow surgery) had throwing sessions Saturday in Sacramento, California.

Marlins: RHP Edward Cabrera (right biceps inflammation) is throwing from 75 feet and is making progress.

UP NEXT

Giants LHP Alex Wood (season debut) is to start the series finale on Sunday while the Marlins go with RHP Pablo Lopez (0-1, 4.60).

More AP MLB: https://apnews.com/MLB and https://twitter.com/AP_Sports