The Cardinals scored all three runs off Pirates reliever Jared Hughes with two outs in the seventh inning to back John Lackey for a 3-2 victory over the Pirates, who lost their seventh in 10 games.
Pedro Alvarez hit his 18th homer in the second off Lackey, but the Pirates managed little after that to fall further behind St. Louis and first-place Milwaukee in the NL Central race. The Brewers beat San Diego, 10-1.
Trevor Rosenthal gave up a leadoff home run in the ninth to Andrew McCutchen but held on to earn his 39th save.
The Cardinals did nothing against Pirates starter Francisco Liriano. He left in the seventh after giving up an infield single to Kolten Wong, but Hughes picked off Wong.
Tony Cruz singled and was moved to second base by John Lackey on a bunt. After a Matt Carpenter walk, Jon Jay singled home Cruz to tie the game and he and he and Carpenter moved up on an error by McCutcheon. Matt Holliday singled them home to put the Cardinals on top.