ST. LOUIS (AP) To earn his 16th win, Adam Wainwright really needed his bat.
''There's usually two or three games a year that you swing the outcome if you can provide something offensively,'' Wainwright said. ''I just made a couple of good swings.''
The bottom of the order was the difference in the fourth win in a row for the NL Central leaders. Eighth-place hitter Peter Bourjos singled twice with an RBI, and seventh-place hitter Daniel Descalso walked twice and scored twice.
Randal Grichuk added three hits and made a nice diving catch in right field to rob Starling Marte of a go-ahead extra-base hit.
''I feel like we're really ready to take off,'' Bourjos said. ''We're getting contributions from everybody.''
Wainwright (16-9) prevailed despite allowing three home runs to match his career worst. He left after Starling Marte's two-run shot shaved the lead to 5-4 with none out in the seventh. It was the first time he had allowed more than one homer all season.
He has been getting by with less than his best stuff for a while, and like most of his recent starts, he believes he is close.
''You can look at the three balls in the middle of the plate that got hit out, but I think most of the time I was much better than I have been,'' Wainwright said.
''That's what we see too,'' manager Mike Matheny said. ''I think he's off just a hair sometimes.''
Russell Martin and Jordy Mercer homered with the bases empty for the Pirates, who have lost three in a row and were frustrated to get beaten by Wainwright's bat. He doubled his season RBI total and is batting .203 overall.
''We treat him like a hitter,'' Martin said. ''He gave some up but he took some back and that's just the type of competitor he is.
''He was one of the toughest outs.''
Despite the damage, Wainwright didn't face any batters with runners in scoring position. He lost his previous two outings, the last at Pittsburgh when he allowed three runs in six innings.
Wainwright had thrown 28 1-3 consecutive scoreless innings at home against Pittsburgh before Martin homered in the second.
The first four Cardinals reached base in a three-run fourth that snapped a 2-all tie. Wainwright's two-run single chased Jeff Locke (6-4), who walked five and was charged with five runs - four earned. Wainwright also had a run-scoring groundout in the second and matched a three-RBI game he had against the Brewers on July 4, 2010, in which he also threw a complete game in a 7-1 win.
Locke allowed a run in 7 1-3 innings with two walks against the Cardinals his last time out. He worked around a season-worst six walks to win at Milwaukee on Aug. 22 and was 4-0 with a 2.90 ERA in five August starts.
''I just didn't have any command, fell behind everybody,'' Locke said. ''They were really in the driver's seat the whole time.''
Jhonny Peralta doubled to start the seventh and scored on a wild pitch by John Axford that put St. Louis up 6-4. Trevor Rosenthal got a day off, and Pat Neshek finished for his fifth save in eight chances.
Cardinals: Kolten Wong didn't start for the second straight game after banging his head making a catch. He pinch-hit in both games, and his homer tied it on Monday.
Pirates: Edinson Volquez (11-7, 3.45) has won seven of his last eight decisions. He is 4-6 with a 5.06 ERA in 14 career starts against the Cardinals.
Cardinals: St. Louis seeks a sweep behind Shelby Miller (8-9, 4.19). The right-hander is 2-6 with a 4.98 ERA against Pittsburgh, including 2-2 this year.
Cardinals 3B coach Jose Oquendo was ejected at the end of the third inning, apparently for arguing balls and strikes with home plate umpire James Hoye.