CHICAGO (AP) -- Francisco Liriano wasn't quite sure where his pitches were going. The one thing he did control was his emotions.
Liriano pitched two-hit ball over seven innings and the Pirates beat the Chicago Cubs 2-0 Friday for their major league-leading 10th shutout, matching Pittsburgh's total for all of last season.
It is, as manager Clint Hurdle said, a ''remarkable number.'' And it stands out even more because the Pirates don't have a complete game.
Liriano (4-2) walked five, his most since Sept. 1 last year, but struck out eight to help Pittsburgh stop a three-game losing streak.
''I didn't feel, location-wise, I was that good,'' he said. ''I was missing my spots a lot, and I walked too many guys. You know, just keep fighting 'til the end.''
Liriano walked two in the second and two in the fourth. But rather than get rattled, he worked his way out of trouble both times and came away with the win after a two-start losing streak.
Mark Melancon pitched the eighth, and Jason Grilli finished the five-hitter for his major league-leading 23rd save in as many chances. After two-out singles by Ryan Sweeney and pinch-hitter Dioner Navarro, Grilli struck out Darwin Barney to preserve another shutout.
''We had 10 (shutouts) all last year and actually we pitched a lot better last year than we did the first year I was here,'' Hurdle said. ''It just speaks to the job the pitchers are doing here, No. 1 throwing strikes, keeping the ball down. We've been able to get a little better at it every year, and this year, obviously, we've taken it to another level at this point in the season.''
Russell Martin had two hits, including an RBI double off Travis Wood (5-4) in the sixth, as the Pirates won for the second time in seven games. Jordy Mercer doubled twice.
Pittsburgh continued to struggle at the plate after managing just one hit off Julio Teheran in a 5-0 loss at Atlanta on Wednesday. This time, the Pirates finished with seven hits.
Wood gave up one run and four hits in six innings with two walks and six strikeouts, but couldn't quite match Liriano on the mound.
''He kept us off balance, kept the ball down all day,'' Wood said. ''He really worked us. Even though he had several walks, he was able to battle around that and pitch a good ballgame.''
He had the Cubs' first hit, a one-out single in the fifth, after hitting his first career grand slam in a win over the Chicago White Sox last week.
''Travis has been the same all year,'' Barney said. ''He's been consistent pounding the zone. He was a little bit more sporadic than he has been. But he still had good stuff. He keeps them off balance.''
Outscored 29-11 and shut out three times in their previous six games, the Pirates went ahead in the sixth.
After escaping a bases-loaded jam in the second, Wood retired 11 straight before Mercer's one-out double. Mercer advanced on Andrew McCutchen's fly to right and scored on Martin's double.
''I just told myself I was going to be aggressive and not wait around,'' Martin said. ''He's throwing lots of strikes, and I picked a side of the plate.''
Travis Snider added an RBI grounder in the ninth against Carlos Villanueva after Martin's walk and Pedro Alvarez's single.
NOTES: Pirates LHP Wandy Rodriguez is to throw a bullpen session on Monday before the team decides whether he will go on the DL, although manager Clint Hurdle did say there was no ''acute structural damage to the ligament'' in Rodriguez's throwing arm. Rodriguez got only one out in Wednesday's loss at Atlanta before leaving with tightness in his left forearm. ... Sweeney, the Cubs' CF, made a neat catch in the eighth when he raced to his right and dove to snag Starling Marte's drive. ... Sveum said Rafael Dolis, on the 15-day DL with a mild strain in his right forearm, is ''a lot better,'' and Shawn Camp (sprained right big toe) threw a bullpen session on Friday. Sveum also said no date has been set for Kyuji Fujikawa to have ligament-replacement surgery on his right elbow. ... A.J. Burnett (3-6, 3.22 ERA) starts Saturday for the Pirates, with Jeff Samardzija (3-6, 2.96 ERA) going for the Cubs.