ST. LOUIS (AP) -- Joe Kelly acted like an ace who's been here before, oblivious to the pennant race and working out of jams. The St. Louis Cardinals rediscovered their offense, too.
Carlos Beltran had RBIs his first two at-bats to help chase A.J. Burnett early and Kelly beat the Pittsburgh Pirates for the third straight time in a 12-8 rout Friday night that pulled the Cardinals within a half-game of the NL Central leaders.
''You've just got to make pitches when you need to,'' Kelly said. ''I just tried to battle ... and make pitches when I needed to.''
Burnett (7-10) gave up five runs in three innings, his shortest outing of the year, and the Cardinals opened a seven-run seventh with nine straight hits off three relievers including Yadier Molina's three-run homer off Bryan Morris. The Pirates have lost two straight, both blowouts, and remain a win shy of clinching their first winning season since 1992.
''I felt like I could have stayed out there longer and kept us in it, but that's not my choice, not my decision,'' Burnett said. ''But you've got to take one positive from tonight and that's this team and what they did to the final out.''
Manager Clint Hurdle said the 82nd win will probably mean most to Neil Walker ''growing up a Pittsburgh kid.''
''He had some emotion the other night and there's some guys on the coaching staff, but I mean, it's part of the game,'' Hurdle added. ''It's a mile marker on the road.''
Kelly (8-3) has been the stopper lately for a struggling rotation, winning five straight starts. He's 8-0 with a 2.10 ERA in 11 appearances since getting the fifth spot in late June and then waiting 14 days because of days off in the schedule to make that start.
Leadoff man Matt Carpenter tripled and doubled to tie Albert Pujols' season record of 98 hits in 2008 at 8-year-old Busch Stadium, also his major league high 55th multihit game. Jon Jay, coming off a 1-for-20 trip, had three hits and three RBIs.
''Wow, I wasn't aware of that,'' Carpenter said. ''That's pretty cool. I thought we just did a real good job of grinding out at-bats and being aggressive in the strike zone.
''They made some mistakes over the plate and we did a real good job of taking advantage.''
The Pirates have scored two runs in 18 innings against Kelly. The only thing the right-hander hasn't done is save the bullpen, working six innings in each of his last five starts with a season best of 6 1-3 innings.
Pittsburgh had five baserunners and no runs the first two innings and stranded 10 runners in six innings against Kelly, who allowed one run and eight hits. Pedro Alvarez, who grounded out with the bases loaded to end the first, had an RBI single in the fifth.
The Cardinals led 12-1 after seven innings but needed Edward Mujica to get the final out for his 36th save in 39 chances. Josh Harrison hit a two-run pinch-hit homer off Jake Westbrook in a four-run eighth and Jose Tabata hit a two-run double off Carlos Martinez in a three-run ninth before Harrison flied out with two men on to end a game that lasted 3 hours and 47 minutes.
The Cardinals rebounded from a 2-5 trip in which they scored two or fewer runs five times, one of them against Burnett in a 7-1 loss Aug. 31. Burnett had been 3-0 with a 2.59 ERA in five starts against the Cardinals, but facing them in consecutive starts led to his fastest exit since he allowed 12 earned runs in 2 2-3 innings, including two homers and seven RBIs by Beltran, in a 12-3 loss May 2, 2012, also in St. Louis.
''I don't make pitches here or I haven't,'' Burnett said. ''I will, I will. When I missed tonight, I missed middle.''
Carpenter tripled to open a three-run third and Jay, Matt Holliday and Beltran followed with RBI doubles for a 5-0 lead. The Cardinals started fast in the first with a walk and two singles the first four at-bats.
''I think we could all tell early on his command wasn't really used to what we're used to seeing from him,'' Carpenter said of Burnett.
The first four hitters in the Cardinals order totaled 10 hits and eight RBIs.
NOTES: Cardinals reliever John Axford was ejected in the eighth after hitting pinch-hitter Tony Sanchez with a pitch after warnings were issued earlier in the game, with manager Mike Matheny also getting the boot. ... Eighth-place hitter Daniel Descalso doubled to open the seventh and flied out for the first out. The Cardinals were three hits shy of matching the major league record of 12 straight hits to start an inning by St. Louis on Sept. 17, 1920, against the Boston Braves and Brooklyn on June 23, 1930, against the Pirates. ... Pete Kozma of the Cardinals had an infield hit in the seventh to end an 0-for-33 slump.