PHILADELPHIA -- Sergio Romo threw his hands out, looked to the sky and screamed in jubilation after working out of the toughest of jams.
Romo has saved big games in the postseason, including three in the World Series. This one may have been his hardest.
Joaquin Arias and pinch-hitter Roger Kieschnick had RBI singles off Jonathan Papelbon in the top of the ninth inning, then Romo escaped a bases-loaded mess in the bottom half as the San Francisco Giants beat the Philadelphia Phillies 2-1 Thursday night.
"I think I was pretty fortunate," Romo said. "The ninth inning off Papelbon was not an easy thing to do. It was a great win for us."
Matt Cain (7-6) gave up one run and six hits in eight innings. The struggling ace lowered his ERA to 4.57.
Cole Hamels allowed seven hits and struck out five in eight scoreless innings. The 2008 World Series MVP hasn't pitched like a three-time All-Star this season, but he left with a 1-0 lead that he gave himself with an RBI single.
Then Papelbon (2-1) blew it -- a familiar scene for the 2012 All-Star closer. He started the season 13 for 13 in save opportunities, but is 7 for 13 since. He heard loud boos throughout the inning and when he walked to the dugout.
"I want to preserve these wins for the starters," Papelbon said. "Some nights you just scratch your head."
Hunter Pence led off the ninth with an infield single and advanced to third on Brett Pill's single to right. Kieschnick followed with a tying single that sent Pill to third, and Arias grounded his go-ahead hit to left.
Romo loaded the bases with no outs before finishing for his 25th save in 29 tries.
Pinch-hitter Delmon Young reached on third baseman Pablo Sandoval's error to start the bottom of the ninth. Cody Asche then tried to sacrifice, but Romo fielded it and slipped, so the rookie got credit for his first major league hit. John Mayberry Jr. was hit by a pitch while trying to sacrifice to load the bases.
"I wanted to go to second, but changed my mind and that's when I fell," Romo said of the bunt.
"Romo did a great job by not panicking," Cain said.
The defending World Series champion Giants took two of three, but remain last in the NL West.
The Phillies are 2-10 since the All-Star break and have dropped to 9 1/2 games behind Cincinnati for the second wild-card spot in the NL.
Cain retired the first 11 batters, striking out five, before Chase Utley lined a single in the fourth.
Nix hit a broken-bat single with two outs in the fifth and Ruiz followed with a single. Hamels then sliced an RBI single down the left-field line for a 1-0 lead.
"That was two guys at the top of their game," Giants manager Bruce Bochy said of Cain and Hamels. "A classic matchup. I really enjoyed it."
Last July, the Phillies gave Hamels a six-year, $144 million extension to pass up free agency. But they're just 6-17 in his starts.
Sandoval was in the lineup for the Giants after leaving Wednesday night's game with a right heel bruise. ... Former Phillies closer Brad Lidge threw out the first pitch. Lidge, who was 48 for 48 in save chances during Philadelphia's 2008 World Series championship season, formally retired as a member of the Phillies. ... Madison Bumgarner (10-6) starts for the Giants at Tampa Bay on Friday night. ... Former ace Curt Schilling will be inducted into the Phillies' Wall of Fame on Friday. ... RHP Ethan Martin will make his major league debut for the Phillies on Friday night against Atlanta's Kris Medlen (7-10). Martin, acquired from the Los Angeles Dodgers in a trade for Shane Victorino last year, is 11-5 with a 4.12 ERA in 21 starts at Triple-A Lehigh Valley. Cliff Lee, who missed his start because of a stiff neck, will pitch Sunday.