Alberto Gonzalez and Will Venable both 5, in the opener of a quick two-game series.

The Giants sent Ramon Ramirez (2-2) to the mound in the ninth after scoring three runs in the eighth to tie the game. Nick Hundley led off with a double down the left-field line, moved to third on a sacrifice bunt and scored the go-ahead run on Gonzalez's base hit up the middle. Gonzalez advanced to second on a wild pitch and crossed the plate on Venable's single to right to account for the final margin.

Mat Latos gave up two runs -- one earned -- on three hits in a six-inning start for the Padres, who have won a season-high five straight games. Erik Hamren (1-0) recorded the final out in the eighth to pick up his first victory in the majors. Heath Bell got his 35th save.

Cody Ross, Hector Sanchez and Orlando Cabrera each drove in a run for the Giants, who sit two games back of Arizona in the NL West. The Diamondbacks beat the Nationals on Tuesday.

Matt Cain allowed five runs -- three earned -- on six hits over seven innings for San Francisco, which has lost six of eight.