PITTSBURGH — Clint Hurdle doesn't dwell on things. What's next is what's important, a mantra the Pittsburgh Pirates manager has pounded home repeatedly since the day he arrived in 2010.
More than four years later, it has become fully ingrained on a team that just keeps rolling along.
Andrew McCutchen hit his 19th homer and Pedro Alvarez made up for some shaky defense by adding his 20th of the season as the Pirates held off the San Francisco Giants 5-2 on Sunday night.
"You've got to play forward," Hurdle said. "You've got to rip out the rearview mirror and play forward."
Something the Pirates have done as well as anybody in baseball this summer. Pittsburgh is 56-26 since a blah 18-22 start and trails St. Louis by 3 1/2 games with six full weeks to go in the regular season.
"There was a lot of different things that happened out there tonight that complicated things at times but we were able to stay in front of it and get the outs when we needed them, add on runs when we needed them," Hurdle said.
It's what the Pirates do. Francisco Liriano (9-6) gave up two unearned runs and struck out five in 5 1/3 eventful innings to win his fifth straight decision. Pittsburgh is 10-0 in Liriano's last 10 starts dating back to June 26.
"Every five days I try to do the best I can and win some ballgames," Liriano said. "I just try to put some zeroes on the board."
Liriano might have enjoyed a smoother night if not for Alvarez. The former third baseman's move to first this season has been a bumpy ride. His 17th and 18th errors of the season directly to both San Francisco runs, but he atoned with a solo shot in the seventh that gave Pittsburgh some breathing room.
Mark Melancon worked a perfect ninth for his major league-leading 39th save.
Matt Duffy had three hits for the Giants. Ryan Vogelsong (9-9) failed to make it out of the fourth inning as San Francisco finished 2-5 on a seven-game road swing through St. Louis and Pittsburgh by leaving 11 men on base.
"A week ago we were getting all the big hits we needed, and this road trip we've had a hard time getting them in," Giants manager Bruce Bochy said. "That's the difference in the game."
The Pirates were hardly crisp — committing three errors in all and allowing San Francisco to hang around by leaving 10 men on base — but Liriano and four relievers helped the Pirates improve to 6-1 against the Giants this season and 19-4 against the NL West.
Arquimedes Caminero came in for Liriano with runners on first and second and Pittsburgh up one in the sixth and promptly induced Duffy to hit into an inning-ending double play.
"I was just trying to get to stay in the zone throwing strikes and see what happens," Caminero said after his 12th straight scoreless appearance.
Joakim Soria worked out of a two-on, two-out jam in the seventh by pinch hitter Brandon Belt to fly out to center. Tony Watson and Melancon breezed through the final six outs.
Vogelsong spent six largely forgettable seasons with the Pirates from 2001-06 and PNC Park continues to give him trouble. He came in 6-13 with a 6.06 ERA at his old home, numbers that didn't improve during another rocky outing. The Pirates touched Vogelsong for three runs in the first thanks to a bases-loaded walk to Jung Ho Kang, an RBI-single by Neil Walker and a sacrifice fly by Alvarez.
It could have been worse, but Pittsburgh — which left no runners on base in a 3-2 walkoff win on Saturday — couldn't convert numerous chances to put the Giants away. The Pirates stranded at least one man in each of the first five innings, though Vogelsong left with one out in the third after needing 77 pitches to retire 10 batters.
"I was throwing everything that I wanted to down there (in warmups)," Vogelsong said. "I just got out there and didn't execute."
Giants: OF Angel Pagan is eligible to come off the DL on Tuesday but instead will play a couple of games for Triple-A Sacramento to test the tendinitis in his right knee.
Pirates: SS Jordy Mercer returned after six weeks on the DL with a sprained left knee. Mercer entered as a defensive replacement in the seventh when Kang shifted to third to replace Aramis Ramirez and went hitless in one at bat.
Giants: San Francisco is off Monday and begins a three-game series at AT&T Park against the Chicago Cubs on Tuesday. The Giants trail the Cubs by six games in the race for the second NL wild card spot. Matt Cain (2-3, 5.66 ERA) faces Chicago's Jake Arrieta (15-6, 2.30) in the opener.
Pirates: Pittsburgh heads to Miami for a four-game set against the Marlins on Monday. J.A. Happ will make his fourth start for the Pirates after arriving in a trade with Seattle last month. Happ threw six scoreless innings against Arizona last Wednesday.
Follow Will Graves at http://www.twitter.com/WillGravesAP