PITTSBURGH -- A special season on the verge of collapse, the Pittsburgh Pirates steadied themselves behind Pedro Alvarez.

The third baseman stayed hot, blasting his 26th homer of the season and driving in three runs as the Pirates rolled to a 5-0 victory over St. Louis on Wednesday night. Alvarez's three-run shot in the third gave him seven home runs and 23 RBI in 15 games against the defending world champions.

"I was just out there trying to compete," Alvarez said. "It's just one of those things."

The win, coming on the heels of a 9-0 rout over St. Louis on Tuesday, pulled Pittsburgh within one game of the Cardinals for the second NL wild card spot. It also gave them a needed boost as September neared.

Searching for the first winning season and playoff berth in two decades, the Pirates appeared in trouble after losing six of seven following a 4-3 defeat on Monday.

Instead, they bounced back with a resiliency that's been their calling card all year and has them playing important baseball into September for the first time since Barry Bonds was patrolling the outfield at Three Rivers Stadium.

"We had to get back on the right track," right fielder Garrett Jones said. "We were in a little rut there where for whatever reason we couldn't get back on the winning track and things weren't going our way. We stayed positive, stayed confident and knowing we could turn things around."

Wandy Rodriguez (9-13) worked six tidy innings for Pittsburgh to pick up his first victory as a starter since being acquired in a trade last month. Rodriguez walked three and struck out three while helping the Pirates shut out the Cardinals for the second straight night.

"You go against that offense and you put 18 zeros on the board in 18 innings, I couldn't be any prouder of them," manager Clint Hurdle said. "Offensively we found a way and had some two out big strikes. To finish the last 48 hours, we're going to battle."

Joe Kelly (4-6) struggled with control problems during five rocky innings, giving up five runs on eight hits.

The victory helped the Pirates take the season series from St. Louis 8-7, not an insignificant number with both teams battling for a postseason berth. If the two clubs are tied for the second wild-card spot at the end of the regular season, the Pirates would have host the play-in game.

The playoffs don't begin for another five weeks. Pittsburgh, however, remains intent on being a factor until the end.

"We can definitely use these two wins as a sparkplug for games to come," Alvarez said.

Particularly if the former first-round pick continues to develop into the lineup-anchoring power hitter the team envisioned when it drafted him four years ago. Alvarez certainly feasted on St. Louis pitching this season, going 23 for 58 (.396).

He gave Rodriguez all the offense necessary in the third. Coming to the plate with two on and two out, Alvarez drilled an 82 mph curveball from Kelly into the right field seats. The ball left the park so quickly Alvarez barely had time to break into his home run trot before it landed.

"I let the hottest hitter on their team beat me," Kelly said. "I was down 3-1 and hung a breaking ball to a good hitter. I made a bad pitch and he made me pay."

The blast gave the Pirates a 4-0 lead and Alvarez made it 5-0 in the fifth when he doubled with two outs and scored on a single by Josh Harrison.

Rodriguez took advantage of the cushion. He came in 0-4 as a starter with the Pirates after being acquired from Houston on July 24. His only victory came in two relief innings during Pittsburgh's 19-inning marathon win in St. Louis on Aug. 19.

Hurdle blamed part of Rodriguez's problems on the pressure of trying to validate the trade. Hurdle urged the veteran lefthander to relax, and Rodriguez looked at ease playing with a sizable lead for the first time as a Pirate. The Cardinals managed just three paltry singles against him and never got a runner to third.

"I feel very comfortable when I see the score 4-0," Rodriguez said.

The Cardinals played without catcher Yadier Molina, who sat out as a precaution following a brutal collision at home with Harrison on Tuesday night. Molina suffered neck, shoulder and arm soreness after Harrison crashed into him trying to score from second.

Tony Cruz started in Molina's place and had two of St. Louis' five hits, but the Cardinals failed to muster any offense as their scoreless streak reached 21 innings.

"We've seen quite a bit of this this year, it's been a lot of feast or famine," St. Louis manager Mike Matheny said. "It's hard to understand it because we certainly have the ability to put something up there every night."

Game notes

Pittsburgh 2B Neil Walker missed his third straight game with a stiff back. Walker said he's starting to feel better but still has no timetable on a possible return. ... The Cardinals begin a four-game series in Washington on Thursday. Jaime Garcia (7-9, 3.72 ERA) takes on Washington's Edwin Jackson (7-9, 3.72) in the opener ... Pittsburgh is off Thursday and travels to Milwaukee for a weekend series on Friday. Jeff Karstens (5-3, 3.47) faces Milwaukee's Mark Rogers (2-1, 4.28) in the first game.