The win helped the Cardinals keep pace with the NL Central-leading Pirates, who topped the Padres, 3-1, Monday to remain a game up on St. Louis.
"They were relentless right there," said Cardinals manager Mike Matheny of his team's lengthy rally that saw nine hitters step to the plate for six singles and a double.
Kolten Wong, who picked up his first big league hit two innings earlier, started the eighth-inning rally by legging out a chopper to Brewers third baseman Aramis Ramirez. It was a bang-bang play at first base, but first-base umpire Marty Foster ruled the speedy Wong safe.
Not everybody agreed.
"If the call goes the other way, we're not standing here," said Brandon Kintzler, who gave up six of the seven eighth-inning hits. "It could go either way."
But it went to the Cardinals, and a game-changing rally ensued.
Pinch-hitters Daniel Descalso and Matt Adams followed Wong with singles. Adams' hit scored Wong to tie the game and Matt Carpenter followed with a tiebreaking single to left field before Carlos Beltran grounded an infield single off Ramirez's glove at third to load the bases. Burke Badenhop then came in to face another pinch-hitter, David Freese, who broke the game open with a two-run double.
"[Adams], Descalso, Freese. All three of those guys had big hits for us in big situations," Matheny said. "You know, we're going to continue to need our bench guys to be sharp and be ready for something big like that. That was very impressive to watch them do that."
The five straight singles off the right-handed Kintzler all came against left-handed hitters. Kintzler entered Monday with a .147 batting average against versus left-handers.
"That's how crazy this game is, right?" Kintzler said. "I give up 11 hits against lefties all year and then give up five in a row. They had a good plan, and next time we'll change our plan and see what happens."
Brewers manager Ron Roenicke marveled at the Cardinals' approach with runners in scoring position prior to Monday's series opener. St. Louis entered the game with a .329 batting average with runners in scoring position, 43 points better than second-place Detroit (.286). They were 4-for-13 in such situations on Monday.
"They understand what you need to do with people in scoring position," Roenicke said. "Whether they talk about it as a team and have a philosophy on it, or whether it's just flat personnel, I don't really know. But they really do it right."
Jon Jay continued his torrid month of August with a sixth-inning two-run home run that put the Cardinals up, 4-2, but the Brewers responded with three runs in the seventh inning off Cardinals reliever Michael Wacha. The right-hander made a throwing error and surrendered four hits in the frame, including a go-ahead two-run home run to Ramirez that gave the Brewers their first lead.
Jean Segura led off the inning with a bunt single that Wacha fielded late and threw well over first baseman Allen Craig's head and into right field, sending Segura to second. Jonathan Lucroy followed with a looping liner to center field, scoring Segura and cutting the St. Louis lead to 4-3, and Ramirez sent Wacha's fifth offering just over the fence in straightaway left field.
Ramirez was 1-for-18 since returning from the disabled list last week before hitting his sixth home run of the year and first since June 26.
Matheny did not think the 22-year-old Wacha became over excited after his early throwing error.
"I don't think he's an excitable guy," Matheny said. "I just think he goes out and makes pitches. Didn't have a real good feel for his changeup today, and that makes a real big difference. When his changeup's on, it's something they have to be thinking about. He just didn't really find the zone with it today."
Brewers starter Marco Estrada held the Cardinals mostly in check through five innings before Jay reminded everybody how good he has been in August. Jay entered the day with an NL-leading 26 hits in August, and his 27th knock carried over the fence in straightaway center field for his seventh home run of the season.
Beltran also homered off Estrada to start the scoring in the first inning -- his 21st home run -- and Yadier Molina went 4-for-5.
Cardinals starter Shelby Miller was in position to pick up his 12th win before the late-inning rallies. The right-hander's line ended at 5 1/3 innings, five hits, two earned runs, four walks and eight strikeouts. He threw 101 pitches, 66 for strikes.