After the Giants spoiled an outstanding effort by Philadelphia starter Cole Hamels, San Francisco closer Sergio Romo loaded the bases with nobody out in the bottom of the ninth and then escaped the jam to preserve the victory.
Hamels was once again the victim of a lack of run support just as it appeared he might win for only the third time in 17 starts.
He threw eight shutout innings and also drove in the only run over that stretch with the third of three consecutive Philadelphia singles in the fifth.
Hamels was replaced in the ninth by Jonathan Papelbon, who has had 26 save opportunities this year and has blown six of them.
Papelbon (2-1) gave up four consecutive singles to start the ninth, Kieschnick and Arias delivering the last two of those to give the Giants the lead.
Arias, however, committed a fielding error to start the bottom of the ninth. That allowed Delmon Young to reach first, after which Cody Asche was safe with a bunt single and John Mayberry was hit by a pitch.
Romo, however, retired the next two batters on shallow fly balls and then got Erik Kratz to ground into a force play. It was Romo's 25th save and handed the win to starter Matt Cain (7-6).
Swim Week Miami Beach 2014 [PHOTOS]