Homer barrage doesn't hold up for Padres

Grandal slugs two of four long balls, including first career grand slam

Homer barrage doesn't hold up for Padres

SAN FRANCISCO -- No team in the big leagues has scored fewer runs than the Padres, so you can imagine the relief and elation that rolled through the visiting dugout at AT&T Park on Thursday as San Diego not only got back into a game it once trailed by six runs, but actually took a late lead.

But on a night when the Padres and Giants combined for 17 runs on 23 hits -- including six home runs -- it was a squeeze bunt by rookie Matt Duffy that made the difference as the Giants saved the final rally for themselves, holding on for a 9-8 victory.

See if you can keep track of this one:

The Giants (86-73) led 6-0 after five innings, allowed eight runs over the next two innings before then managing to reclaim the lead in the bottom of the seventh with three runs, the last on Duffy's bunt, which allowed Hunter Pence to race home.

Trailing, 6-0, the Padres (76-83) scored three runs in the sixth inning and five more in the seventh inning to take an 8-6 lead, as Yasmani Grandal's second home run of the game, a grand slam, proved to be the big blow in the inning. Rene Rivera also had a home run in that seventh inning.

Grandal's grand slam, his 15th home run of the season and first slam of his career, came off Giants reliever Jean Machi. It gave the Padres a 7-6 lead. He raised his right arm after dropping the bat in celebration.

"Just to get the opportunity to put that up on the scoreboard after being down by six was huge," Grandal said. "A lot of balls were flying out today."

It was the Padres' first four-homer game since hitting four against the Giants on July 14, 2013, at Petco Park.

"[Four home runs] in a ballpark not conducive for homers, either," said Padres manager Bud Black. "We put some good swings on the ball and on their bullpen."

Earlier in the game, Brandon Belt and Brandon Crawford each hit home runs and Pablo Sandoval knocked in three of his four runs as the Giants took what appeared to be a safe six-run lead into the sixth inning.

All appeared well, as earlier in the day, the Giants clinched a spot in the National League Wild Card game when the Brewers lost to the Reds.

The Giants scored at least one run in each of the first five innings against pitcher Andrew Cashner, who yielded six earned runs on eight hits in five innings with one walk and four strikeouts.

"Their game plan was different than the other night," Cashner said. "... There were a couple of tough at-bats here and there and a couple of close pitches. But overall, there were more balls left up in the zone than down in the zone."

The six earned runs tied the most Cashner has allowed as a starter with the Padres. He also allowed six against the Rockies (Sept. 14, 2012) and the Nationals (July 5, 2013).

"They were looking for the ball up and he couldn't get his slider in a good spot," Black said. "He couldn't locate his pitches early in the count."

San Francisco pitcher Yusmeiro Petit allowed a single to Will Venable with one out in the first inning and then set down 12 of the next 13 batters he faced.

The Padres started their comeback in the sixth inning when Cory Spangenberg singled and scored as Will Venable hit an opposite-field home run to left-center.

Grandal added his first home run of the game, a solo shot off the right-field foul pole, later in the inning to cut the lead to 6-3 and end Petit's night.

Tim Lincecum, who has thrown no-hitters in each of the past two seasons against the Padres, earned the victory in relief -- win No. 100 for his career -- by throwing two pitches. He's 11-9. Blaine Boyer (0-1) took the loss for the Padres with rookie Frank Garces being tagged with a blown save.

Corey Brock is a reporter for MLB.com. Keep track of @FollowThePadres on Twitter. This story was not subject to the approval of Major League Baseball or its clubs.