Buster Posey tied the game with a two-run homer in the eighth inning and Brandon Belt hit a pinch-hit, RBI single in the ninth to give the San Francisco Giants a 5-4 win over the Diamondbacks.
Posey also had a run-scoring double for the Giants, who have won four straight and improved to 9-1 against the rest of the NL West so far this season.
Sergio Romo (1-1) retired the final batter in the top of the ninth to earn the win behind Ryan Vogelsong, who was on the hook for the loss before Posey took David Hernandez deep in the eighth.
Vogelsong was charged with four runs on seven hits over seven innings and served up a solo homer to his counterpart, Wade Miley.
"There's no quit in this team, I can tell you that," said Vogelsong. "We fight to the last out. It's fun to watch."
Miley was in line for the win after allowing two runs on seven hits in 6 2/3 frames, but the bullpen's failure resulted in the club's sixth loss in nine games.
"They put together a good inning late," Miley said. "It just slipped away from us."
Miley broke a 2-2 tie in the fifth when he crushed a leadoff shot into the right-field bleachers on a 2-0 fastball. Eric Chavez padded Arizona's lead in the sixth with a line drive to left-center that carried into the first row of seats.
Brad Ziegler relieved Miley in the eighth and stranded two runners but was pulled at the start of the ninth in favor of Hernandez, who gave up a one-out single to Pablo Sandoval in front of Posey's tying homer to straightaway center.
In the ninth, Tony Sipp (1-1) gave up a leadoff single to Andres Torres, who took second on a sacrifice bunt and scored the winning run without a throw when Belt found the gap in left field to bring in the deciding run.
Giants pitchers came in with a 21-inning scoreless streak that quickly ended in the first frame when Cody Ross stepped in with the bases loaded and looped a single to right field to bring in Gerardo Parra and Martin Prado, who both reached on singles.
San Francisco just as quickly evened things in the bottom half with three straight doubles from Marco Scutaro, Sandoval and Posey -- the latter two each driving in a run.
Sandoval has 18 RBI this season ... The Giants and Diamondbacks split 18 meetings in each of the past two seasons ... Game time: 2:36.