Updated

Norichika Aoki registered two hits, an RBI and three runs scored, as the Milwaukee Brewers avoided a three-game sweep at the hands of the St. Louis Cardinals with a 6-4 triumph at Miller Park.

Scooter Gennett, Jonathan Lucroy, Aramis Ramirez and Carlos Gomez each added an RBI to help the Brewers snap a three-game skid.

"I think it's great for them. You play the Cardinals right now, it's a playoff atmosphere," Brewers manager Ron Roenicke said.

Wily Peralta (11-15) held the Cardinals to three runs on five hits and as many walks over five-plus frames to pick up the win. Jim Henderson allowed a run in the ninth, but stranded the potential tying run on first to secure his 26th save of the season.

Matt Carpenter clubbed a solo homer for the Cardinals, who clinched a playoff berth despite the loss after Washington dropped the opener of its doubleheader against Miami.

Joe Kelly (9-5) gave up six runs -- three earned -- on seven hits and two walks over seven innings to absorb the loss.

"We made many mistakes and were lucky to have been that close," Cardinals manager Mike Matheny said.

St. Louis still occupies the top spot in the NL Central, holding a 2 1/2-game lead over both Cincinnati and Pittsburgh, who are tied for the NL's two wild card spots.

Milwaukee tagged Kelly for two runs in each of the first two frames to grab an early 4-0 lead.

Aoki led off the home half of the first with a single and Lucroy doubled two batters later before Ramirez singled to left to score Aoki. Gomez followed with a sharp grounder back to Kelly, who fired to second to start a potential inning-ending double play, but Gomez beat Carpenter's relay throw to first, allowing Lucroy to score for a 2-0 lead.

Martin Maldonado reached on third baseman David Freese's fielding error with one out in the second before moving to third on Peralta's sacrifice bunt.

Aoki followed with a double to plate Maldonado before scoring when Gennett reached on Kelly's throwing error to make it 4-0.

Carpenter clubbed a one-out blast in the third before St. Louis scored twice in the sixth to pull within a run.

The Cardinals opened the sixth with three consecutive singles to load the bases and chase Peralta, as Donovan Hand entered from the bullpen.

Hand served up back-to-back sacrifice flies to Shane Robinson and Kelly, but fanned Carpenter to end the inning with Milwaukee clinging to a 4-3 lead.

Milwaukee provided the bullpen with some breathing room in the seventh, as Aoki walked with one out before scoring on Gennett's double to center. Gennett, who moved to third on the play, scored on Lucroy's sac fly to make it 6-3 in favor of the Brewers.

In the ninth, Carpenter and Jon Jay stroked back-to-back two-out singles before Carlos Beltran's base hit to center scored Carpenter to make it 6-4, but Henderson caught Matt Adams staring at strike three to end the game.

Game Notes

Kelly fell to 0-3 in five appearances (two starts) against Milwaukee this season ... Peralta has won three of his last four starts ... St. Louis went 2- for-7 with runners in scoring position and left nine men on base.