James McDonald spun six scoreless innings of two-hit ball Friday, as the Pittsburgh Pirates downed the St. Louis Cardinals, 2-1, in the opener of a three-game set at Busch Stadium.

McDonald (11-5) struck out seven and walked three to earn his first victory since July 18 (five starts). Joel Hanrahan fired a scoreless ninth to nail down his NL-leading 34th save of the season.

"I just told myself I'm doing this for my teammates and me, just to go out there and have fun," said McDonald about snapping his losing skid. "Don't worry about what other people say, just go out there and compete and play the game of baseball. I don't need the extra distractions to make it harder than what it is."

Travis Snider and Andrew McCutchen each scored a run for the Pirates, who won their second straight game to extend their lead over the Cardinals to two games in the race for the second of the NL's two wild card slots.

Jake Westbrook (12-9) allowed just two runs -- one earned -- on six hits and three walks over 7 2/3 frames despite receiving the loss.

Tony Cruz knocked in the lone run for the Cardinals, as they dropped their second straight contest.

Pittsburgh plated both runs in the fourth inning without registering an RBI.

Snider walked before McCutchen and Garrett Jones smacked back-to-back singles to load the bases.

Westbrook then uncorked a wild pitch, allowing Snider to score for the game's first run before a fielding error by Rafael Furcal reloaded the bases.

Cruz was then charged with a passed ball as McCutchen crossed home to make it 2-0 in favor of Pittsburgh.

Westbrook worked his way out of the jam, however, as David Freese threw out Jones at the plate on Pedro Alvarez's fielder's choice before Clint Barmes grounded into an inning-ending double play.

Allen Craig's one-out double in the fourth gave the Cardinals their first hit of the game, but he was thrown out trying to steal third before Matt Holliday popped out to second as McDonald faced the minimum through four.

With McDonald done after six frames, the Cardinals jumped on reliever Chris Resop, as Carlos Beltran singled to start the seventh and Freese followed with a double.

After Daniel Descalso flied out to shallow left, Cruz plated a run with an RBI groundout. Juan Cruz entered from the bullpen and got Furcal to pop out to maintain Pittsburgh's one-run lead.

Jason Grilli then fired a perfect eight and Hanrahan worked around a one-out walk in the ninth to close out the victory.

"He did a good job. He pitched deep into the game," said Cardinals outfielder Jon Jay of McDonald. "He has a good bullpen. He turned it over to them and they did a good job of shutting us down."

Game Notes

Westbrook has now gone 13 consecutive starts of six innings or more. He had won his last five starts ... St. Louis third base coach Jose Oquendo was ejected by home plate umpire Lance Barrett in the sixth inning for arguing balls and strikes ... Pittsburgh went 1-for-8 with runners in scoring position and left five on base.