MILWAUKEE (AP) The Milwaukee Brewers just might have to start giving fans in the outfield seats batting helmets.

Jett Bandy, Eric Thames and Travis Shaw each hit home runs to help the Milwaukee Brewers beat the St. Louis Cardinals 7-5 on Thursday night.

Bandy hit a two-run homer to left in the sixth and Thames put Milwaukee ahead with a two-run shot to center off Carlos Martinez (0-3) in the fifth. Shaw's three-run blast in the first made it 12 consecutive games that the Brewers have homered. They lead the majors with 32 home runs.

Shaw's fifth home run of the season traveled 458 feet and smacked off the facing of the third deck in right.

"The first day Travis was here, he took BP and saw some balls go to places I hadn't seen in a while," Brewers manager Craig Counsell said.

Thames jumped all over a mistake from Martinez.

"Carlos Martinez is nasty," Thames said. "He's got a good fastball, good changeup, really good slider. I was trying to get something to hit and I put a barrel on it."

Martinez gave up a career-high five runs to the Brewers on seven hits in five innings. He walked two and struck out seven.

"We've watched him pretty closely," Cardinals manager Mike Matheny said of Thames. "He's obviously hot and on a pretty impressive run. The home run looked to me like it had more of the plate than we wanted and up more a little bit more than what maybe we'd like."

After he got out of the first, Martinez retired the side in order the next three innings before Thames' home run.

"He did find a nice groove after that (first inning)," Matheny said. "Unfortunately, by then, we already had some trouble to deal with."

Zach Davies (1-2) allowed four runs on eight hits in 5 1-3 innings. He walked two and struck out five, but needed Thames' NL-leading eighth home run and seventh in the last eight games for his first win in four starts.

Matt Carpenter hit a solo home run in the top of the fifth and Kolten Wong, whose career-high seven triples led the Cardinals in 2016, hit his first of the season in the top of the second with the bases loaded.

The Brewers have hit two or more home runs in a franchise-best six consecutive games and the 11th time overall.

CARPENTER HEATS UP MILLER PARK

Carpenter's home run was his sixth at Miller Park and his highest total at any ballpark other than Busch Stadium.

TRAINER'S ROOM

Cardinals: Infielder Jhonny Peralta was put on the 10-day disabled list because of an upper respiratory condition. He sat out the four previous games, and the move was retroactive to Sunday. He is hitting .120 (3 for 25) with no RBIs in eight games.

"Ever since we left camp, he's been dealing with some upper respiratory issues that I think they (medical staff) were trying to identify," Cardinals general manager John Mozeliak said. "They were having him use different medications. Unfortunately, it just didn't sit well with him."

St. Louis recalled left-hander Tyler Lyons before Thursday night's game. His 2016 season ended July 31 because of a right knee stress reaction. He made three appearances in rehabilitation games with Triple-A Memphis this season, allowing two runs in 14 innings.

UP NEXT

Cardinals: RHP Adam Wainwright (0-3, 7.24 ERA) makes his fourth start of the season. With a win, he passes Dizzy Dean (134) for sole possession of 6th place all-time in franchise history. He is 14-8 (2.16 ERA) in 28 career starts against the Brewers.

Brewers: RHP Wily Peralta (3-0, 2.65) makes his fourth start of the season and 17th overall against the Cardinals who have been tough on him. He is 0-7 with a 4.85 ERA in his last nine starts against St. Louis.