SAN DIEGO --Fighting for a postseason berth, Jeff Samardzija and the San Francisco Giants finally figured out the pesky San Diego Padres.
Angel Pagan's single broke a scoreless tie in the eighth and Samardzija struck out nine in seven innings for the Giants, who beat the Padres 2-1 on Thursday night to keep pace with the New York Mets for the NL wild card lead.
The Mets and Giants took a half-game lead over the idle St. Louis Cardinals in the wild card race. New York beat Philadelphia 9-8 in 11 innings.
San Francisco continues to trail Los Angeles by six games in the NL West, but the Dodgers reduced their magic number to four by beating Colorado 7-4.
The Giants faced a Padres lineup that included five rookies, three making their big league debut. The Giants snapped a six-game losing streak to the Padres, who have been their nemesis during their second-half skid. The Padres swept the Giants at San Francisco last week and in San Diego in the first series after the All-Star break. The Giants had swept the Padres three times in the first two months of the season.
Samardzija joined the Giants as a free agent so he could pitch in games like this.
"It's great, that's why I signed up to come over here and play, was to be playing in September, important games in September," he said. "That's why we play this game, to compete at the highest level, and with the most on the line.
"I tried to hang in there in the game long enough and then we squeaked on through there in the eighth. It was a nice way to end it."
Samardzija (12-10) allowed four hits in seven scoreless innings, and walked none.
"He's a horse," manager Bruce Bochy said. "That's obviously part of the deal, what intrigued us about him, his stuff and how strong he is. He's really good, throwing the ball well right now, all his pitches locating. Gave us what we needed.'"
Joe Panik, who had been in an 0-for-24 slump, doubled to right-center opening the eighth against Christian Friedrich (5-11). His fly ball ticked off the end of rookie Hunter Renfroe's glove, hit the ground and bounced over the fence. Kelby Tomlinson, pinch-hitting for Samardzija, singled to left to put runners on the corners and chase Friedrich. Brad Hand came on and induced Eduardo Nunez to hit into a force, with Panik holding at third. Pagan then hit a blooper that landed just fair and brought in Panik.
Renfroe fielded Panik's blooper and made a strong throw, but first baseman Wil Myers cut it off.
"Since there was no other play there, Wil probably wants to let that ball go," manager Andy Green said. "I think he'd say that right now. I don't think we're accustomed to Hunter Renfroe's arm yet. That is a very unique play to see a ball drop on the line like that and see a guy coming up firing like that. I don't know how far up the line it was going to be to Hedgy (Austin Hedges), but I thought it was going to be close enough to be an interesting play at the plate. ... There's some arm strength there."
Hunter Pence doubled with two outs to bring in Nunez.
Padres pinch-hitter Alex Dickerson homered off Derek Law with one out in the eighth.
Sergio Romo pitched the ninth for his second save in as many chances. Schimpf doubled with one out before Renfroe popped up to first base and fellow rookie Carlos Asuaje grounded to short to end it.
Padres outfielders Renfroe and Manual Margot, and second baseman Asuaje were making their first big league starts.
Renfroe, Margot, Asuaje and Hedges were called up Wednesday from Triple-A El Paso. Renfroe and Asuaje made their big league debuts as pinch-hitters on Wednesday night while Margot made his as a pinch-runner. Hedges made his big league debut last year.
Renfroe singled to left for his first career hit in the second and then singled to center in the fifth.
Padres reliever Jose Torres made his big league debut when he started the ninth.