SAN FRANCISCO — Giants leadoff hitter Angel Pagan brought another sold-out crowd at AT&T Park to its feet with his two-out, tying RBI single in the sixth inning.

Two innings later, most of those same fans scurried for the exits after Pagan hit into a 1-2-3 double play — one of three turned by Miami — effectively ending San Francisco’s hopes of a comeback.

Pagan had two hits and Hunter Pence homered, but the Giants once again struggled with runners in scoring position in a 5-4 loss to the Miami Marlins on Sunday.

“We thought we had a great chance there,” San Francisco manager Bruce Bochy said. “Bases loaded, we have the right guys up, too. Angel hits that ball anywhere else, they’re giving us a run and we tie the game. It just went back to the pitcher. “

The Giants battled back from a 4-2 deficit in the sixth and tied the game on Pagan’s single to left.

Miami broke the tie on J.T. Realmuto’s solo home run in the eighth, but San Francisco loaded the bases against Marlins reliever David Phelps with no outs in the bottom of the inning.

Phelps then got Pagan to ground into the double play before getting Joe Panik to strike out looking.

“A double play anywhere else ties the game,” Phelps said.

The Giants fell to 2-5 on their 10-game homestand.

Realmuto matched his career high with four hits to help the Marlins avoid a three-game sweep.

Giancarlo Stanton also homered and reached base four times, Christian Yelich drove in two runs and Dee Gordon and Marcell Ozuna had two hits apiece for Miami, which won for just the third time in 11 games.

Realmuto had been hitless in 15 at-bats at AT&T Park before singling twice and doubling off Giants starter Matt Cain. His homer off reliever Josh Osich (0-1) was his first since Sept. 16.

Kyle Barraclough (1-0), the fourth of six Miami pitchers, retired three batters for the win. A.J. Ramos worked the ninth for his third save.

It was a much-needed shot in the arm for manager Don Mattingly’s ballclub, which has struggled through the first month of the season. Mattingly was ejected on Friday and the Marlins suffered back-to-back lopsided defeats before bouncing back to avoid their first three-game sweep by the Giants since 2010.

Stanton homered leading off the top of the fourth. Pence countered in the bottom of the frame with his own leadoff home run.

“It’s good for us,” said Stanton, who had three hits. “Everyone contributed, too, that’s the big part. Not just one getting one big day from one guy.”


Cain allowed four runs over 5 2/3 innings with four strikeouts and two walks. It’s the first time this season that the three-time All-Star has pitched into the sixth inning. “It was definitely something that was kind of weird,” he said. “To get through that, that’s what you’re supposed to do as a starter. You’re supposed to get deep into the game. That’s not something that I’m too worried about.”


Giants: CF Denard Span, who is hitting .350 on this homestand, walked as a pinch-hitter in the eighth. Span did not start for just the second time this season after being limited to a career-low 61 games because of injuries in 2015. … Belt was also held out of the lineup before pinch-hitting in the sixth.


Marlins: LHP Wei-Yin Chen (0-1) pitches Monday in the opener of a four-game series with the Dodgers.

Giants: LHP Madison Bumgarner (1-2) starts against San Diego on Monday at AT&T Park. Bumgarner pitched into the seventh inning in his last outing, the first time he’s done that this season.