CINCINNATI (AP) -- Angel Pagan made the Giants' long trip home a little easier.
Pagan hit a three-run homer in the ninth inning Thursday, lifting the San Francisco Giants to a 6-5 win over the Cincinnati Reds .
"We were all pumped when I got back to the bench," Pagan said. "We were thinking about a happy flight home."
The Giant avoided a three-game sweep and snapped a seven-game losing streak at Great American Ball Park.
"It was one of those games that save your sanity," Giants manager Bruce Bochy said.
Joaquin Arias , who was called up Wednesday when Aubrey Huff was placed on the disabled list with an anxiety disorder, led off the ninth against Cincinnati closer Sean Marshall (0-2) with a walk, and Ryan Theriot followed with a single. After pinch-hitter Brett Pill struck out, Pagan lofted a 1-2 pitch 386 feet into the left field seats.
Pagan was ready for the curveball after striking out against Marshall on the pitch Wednesday night.
"I knew he was going to throw it again," Pagan said. "I had to make an adjustment. I swung at one in the dirt last night. This one was in the strike zone."
"The curveball's been a good pitch for me," said Marshall, who blew his first save after converting four opportunities. "I've gotten some outs with it. The ball hung in the middle of the plate. He didn't get a good swing on it. What hurts is the guys played so well."
Javier Lopez (2-0) allowed two hits but no runs in the eighth to earn the win. Santiago Casilla struck out the side in the ninth for his second save.
Casilla is replacing Brian Wilson , who will miss the rest of the season with an elbow injury.
"You have to throw strikes. That's number one," Casilla said. "Having six saves last year helped and I pitched the ninth inning in the Dominican. When I pitch more I feel better."
Casilla bailed out a bullpen that had a rough series.
"You can't throw the ball any better than Casilla did," Bochy said. "Our bullpen has been struggling this series, too. We haven't played our best baseball yet."
Jay Bruce hit a two-run home run in the sixth inning and Scott Rolen led off the seventh with his second of the season, both in the last two games.
Giants third baseman Pablo Sandoval went 1 for 5, extending his season-opening hitting streak to 19 games, a franchise record. He went into the game tied with Johnny Rucker , who hit in the first 18 games of the 1945 season with the then-New York Giants.
Reds starter Homer Bailey lasted 6 1-3 innings, allowing seven hits and three runs - two earned - with two walks and six strikeouts.
Giants starter Ryan Vogelsong gave up seven hits and four runs with two walks and five strikeouts in six innings.
The Reds took a 2-0 lead in the second on Devin Mesoraco 's sacrifice fly and Bailey's RBI single. The Giants capitalized on shortstop Zack Cozart 's error to tie the score with two runs in the fourth inning.
Bruce broke the tie with his fourth homer of the season, a 381-foot shot to right-center field that just cleared the glove of the leaping Pagan. The homer was Bruce's first since hitting two against the Miami Marlins on April 8.
Pinch-hitter Gregor Blanco came up with a sacrifice fly to cut Cincinnati's lead to 4-3 in the seventh before Rolen's 429-foot homer.
NOTES: Marshall's appearance was the 300th of his career. ... The Giants hadn't won in Cincinnati since a 3-0 win on June 8, 2010. ... Pagan extended his hitting streak to 11 games (16 for 52, .308) with a seventh-inning single. ... Giants C Buster Posey went 0 for 3 with a walk to see his hitting streak snapped at eight games. ... San Francisco RF Nate Schierholtz went 0 for 4 to extend his streak of consecutive hitless at bats to 12.