SAN FRANCISCO (AP) -- His left oblique no longer a painful obstacle, Francisco Liriano is starting to look like the dominant pitcher he was for Pittsburgh in 2013.
With the Pirates in the thick of the race in the NL Central, the timing couldn't be better.
Liriano struck out a season-high 11 in seven innings to win consecutive starts for the first time this season and Pittsburgh beat the San Francisco Giants 3-1 on Tuesday night.
''I was just trying to hit my spots, make some good pitches,'' said Liriano, who last won consecutive starts nearly a year ago. ''My last start and tonight, everything's getting better pitching-wise and I'm getting ahead with the fastball.''
Josh Harrison hit a leadoff home run in the first inning and Travis Snider added a two-run shot in the second for the Pirates, who moved within one game of first-place Milwaukee in the NL Central.
A former minor league prospect for the Giants, Liriano (3-7) gave up a home run to Mike Morse but was otherwise stellar while leading the surging Pirates to their eighth win in 11 games. The left-hander allowed four hits, walked one and retired 18 of the final 21 hitters he faced.
More importantly, Liriano threw first-pitch strikes to 19 of the 26 hitters he faced. He's 2-0 with a 0.95 ERA over the last three starts.
''I thought it was his best outing,'' Pittsburgh manager Clint Hurdle said. ''The fastball played so well, he was able to get them into a swing mode. This is a guy who was a huge part of the success we had last year. That's why I felt it was important to get him up and running again.''
San Francisco lost its sixth straight, matching its longest skid of the season.
Harrison hit a 3-2 pitch from Giants starter Tim Hudson off the facing off the brick wall in right field for his first career leadoff home run. Harrison is hitting .583 (7 for 12) with a double and three home runs over his past three games.
Snider hit his seventh homer after Ike Davis reached on an infield single leading off the second.
It was just enough to help the Pirates (57-49) move a season-high eight games over .500.
Mark Melancon worked the ninth for his 20th save.
Buster Posey had three of the Giants' six hits, including a leadoff single in the ninth. Pablo Sandoval followed with a deep fly out to right before Melancon struck out Morse and pinch-hitter Travis Ishikawa.
''We're sputtering with the offense,'' San Francisco manager Bruce Bochy said. ''We just can't string together a few hits. We have to find a way. It's tough to go through this.''
Hudson (8-8) allowed six hits over seven innings and took his sixth loss in the last eight starts.
The Pirates have won 17 consecutive games when scoring first. ... The Giants have lost eight of their last nine series at AT&T Park. ... Posey hadn't had a multi-hit game at home since June 26. ... Hudson is 1-6 with a 4.32 ERA over his past eight starts.
San Francisco has scored just five runs over its past five games and has had four extra-base hits during that span.
Pirates: Outfielder Starling Marte ran the bases but has not yet been cleared to play after being placed on the 7-day concussion list. Marte is eligible to come off the DL on Wednesday but no move is expected.
Giants: Right-hander Matt Cain plans to meet with specialist Dr. James Andrews this week to get a second opinion on his injured elbow. Bochy said the move is precautionary and that surgery has not yet been discussed.
Tim Lincecum (9-7) pitches the finale for the Giants on Wednesday. Charlie Morton (5-10) goes for the Pirates, who are seeking their first sweep at San Francisco's waterfront ballpark since 2007.