SAN DIEGO — As much as the San Francisco Giants have been through since the All-Star break, with all the blown leads and the offensive struggles, it would have been gut-wrenching if they hadn’t pulled out a victory the way they did Saturday night against the lowly San Diego Padres.

The Giants blew a six-run lead before scoring three times in the 10th inning, including a two-run home run by Denard Span, to beat the San Diego Padres 9-6 and pull even with the New York Mets atop the NL wild-card standings.

“You’re proud of the guys,” manager Bruce Bochy said.

“You give up a six- run lead and they come back and tie it, that’s tough to take, especially in our situation. They’re all must-wins. You’ve got your guy out there and couldn’t hold on. That can be so frustrating.”

The Giants, who had given Madison Bumgarner a 6-0 lead before the left-hander allowed three home runs, pulled into a wild-card tie with the Mets, who lost 10-8 to the Philadelphia Phillies. The St. Louis Cardinals are a half-game back after beating the Chicago Cubs 10-4.

Angel Pagan started the winning rally for the Giants when he singled to center off Kevin Quackenbush (7-7) leading off the 10th. Ehire Adrianza sacrificed him before Kelby Tomlinson singled to right. Renfroe booted the ball, allowing Pagan to score. Span followed with his 11th homer.

Will Smith (2-4) pitched one-third of an inning for the win. Sergio Romo came on with a runner on first and no outs in the 10th. He struck out rookie Manuel Margot and allowed Alexi Amarista’s single before Wil Myers grounded into a game-ending double play for his third save.

Bumgarner allowed five runs and four hits in six innings, struck out five and walked one. He also doubled twice and scored one run.

“Man, that’s a tough one,” Bumgarner said. “I was thinking, that’s the best I felt all year, by far, best stuff, best command, everything was there, good as I could hope for it to be. Just kind of a weird one.

“It was a really big win for us.”

Bumgarner’s strikeout of Jon Jay in the fourth inning marked his 245th this season, surpassing Cy Seymour’s 118-year-old franchise single-season record for a left-hander.

“That’s not what I’m here for, but it’s pretty special to get the opportunity to do that,” he said.

“He didn’t make many mistakes, what’d he give up, four hits, three of them home runs?” Bochy said. “It looked like the same pitch on all of them. He didn’t quite get where he wanted, but they took advantage of it. But he was throwing well, four hits, that’s a pretty good outing, except for three of them left the park.”

The Giants staked Bumgarner to a 6-0 lead before he allowed the first Padres hit, Renfroe’s first career home run, with two outs in the fourth.

The Padres continued to claw back on Derek Norris’ two-run homer in the fifth, his 14th, and Adam Rosales’ two-run shot with two outs in the sixth, his 12th, that cut the Giants’ lead to 6-5.

San Diego tied the franchise record of 172 home runs (1972).

Hunter Strickland came on and blew the save when rookie Manuel Margot singled to center for his first big league hit and RBI.

“Down 6-0 off Madison Bumgarner, you usually lose that baseball game,” Padres manager Andy Green said. “Probably about every time in his career they’ve probably held on and won that baseball game. We were right there on the cusp of winning it. We had every chance to and our guys fought hard. The fight was really good. You obviously want to come out on top.”

Yangervis Solarte, who returned to the Padres a week after his wife, Yuliett, 31, died of cancer, started the seventh-inning rally with a pinch single with two outs. He pointed to the sky after rounding first. Solarte advanced on a wild pitch and was replaced by pinch-runner Travis Jankowski, who then scored the tying run on Margot’s single. Margot’s hit came two pitches after a foul ball bounced off the ground and hit him in the forehead.

Padres starter Jarred Cosart left with right elbow inflammation after allowing three runs on three hits and two walks in the first inning. Joe Panik hit a two-run single and Pagan had an RBI base hit.

Jose Dominguez then gave up three runs in the fourth, on three hits and a walk.

Nunez, the Giants’ third baseman, made a terrific play in the second. Catcher Buster Posey lost rookie Carlos Asuaje’s pop foul in the lights. Nunez saw his catcher in trouble and came racing in to make the catch, with his momentum carrying him into the net behind the plate.

“That was really fun to see our team fight like that,” Nunez said. “That was a big, huge win today.”


Giants: Rookie Ty Blach (0-0, 0.00) will make his first career start on Sunday in place of Johnny Cueto, who left his start Tuesday night with a strained groin.

Padres: LHP Clayton Richard (3-3, 2.98) is scheduled to make his eighth start for San Diego and 35th overall.