ST. LOUIS -- Jack Flaherty got an extra day of rest and a chance to pitch against Milwaukee, and took advantage of both.
"As the season goes on, whether you are facing a team for the first time or for the third time, there's adjustments made on both sides," Flaherty said.
"Whoever I'm out there I'm pitching against, I'm pitching against."
The Cardinals won for the ninth time in 10 games and pulled within a half-game of the Brewers for the National League's second wild-card spot.
Milwaukee has dropped three of four.
Flaherty (7-6) gave up three hits, walked three and struck out seven. The Brewers had only two runners reach second base against the rookie, who has allowed two earned runs in his past 19 innings pitched.
Friday marked his third start against Milwaukee this year and fourth in his young career. In 18 innings this season, he's allowed two earned runs in 18 innings and struck out 29.
"He pitched well," Brewers manager Craig Counsell said. "He did a nice job."
Bud Norris earned his 24th save in 28 opportunities.
Freddy Peralta (5-4) went six innings, giving up three earned runs. He allowed three hits, walked three, and struck out five. It was his third loss in his last four decisions.
Wong made a nifty play to start the eighth by charging a hopper that bounded over pitcher Jordan Hick's head. Wong snagged the ball in his glove and made a hard sidearm throw to get Keon Broxton at first. That turned out to be important because the Brewers scored twice that inning and cut the lead to 3-2.
"I always take pride in my defense and when I can make great plays like that for the pitcher, that's always huge," Wong said. "To come up clutch was a big day for me."
He capped his night with a two-run double in the eighth to pad the Cardinals' lead to 5-2.
Jedd Gyorko hit his 10th home run of the season to open the fourth. The shot to left field gave the Cardinals a 3-0 lead.
The Brewers threatened a comeback in the eighth. They loaded the bases against Hicks, and Jesus Aguilar hit a two-run single to pull the score to 3-2 with one out. But Travis Shaw fouled out to left field and Jonathan Schoop's flair to shallow center field was caught by shortstop Paul DeJong.
Cardinals 1B Matt Carpenter was issued an intentional walk in the seventh and has reached base in 35 consecutive games. It's the longest such streak in the majors.
Brewers: OF Eric Thames was removed from the game before the bottom of the third inning with a sore right knee. The right fielder collided with center fielder Lorenzo Cain while making a catch in the bottom of the first. Manager Craig Counsell said after the game that Thames is day-to-day. ... C Manny Pina was held out of Friday's game as a precaution following a collision with the Cubs' Javier Baez on Wednesday. Counsell said Pina should be available for the remainder of the weekend series, but wanted to provide another day of rest for his left shoulder that was hurt when he dove back into second against the Cubs.
Cardinals: RHP Carlos Martinez (right shoulder strain) continues his rehab assignment and was available to work out of the Double-A Springfield bullpen on Friday. The Cardinals announced earlier in the week that Martinez, typically a starter, would serve as a reliever when he returns to St. Louis. The Cardinals hope to have him back next week . IF Yairo Munoz (right wrist sprain) begins his rehabilitation assignment in Springfield on Saturday. ... RHP Michael Wacha (left oblique strain) is headed to Palm Beach, Florida to begin a rehab assignment. He went on the DL on June 21.
Cardinals: RHP Miles Mikolas (12-3, 2.85) has won five consecutive games. He went seven innings in each of his last three starts and the Cardinals have lost just one of the past eight games in which he started.
More AP baseball: https://apnews.com/tag/MLBbaseball
Hendricks strikes out 11, Cubs beat Diamondbacks 5-1
Kyle Hendricks struck out a season-high 11 over seven scoreless innings in his first win, and the Chicago Cubs beat the Arizona Diamondbacks 5-1 on Friday.
Hendricks strikes out 11 in Cubs' win
Kyle Hendricks catches fire with 11 strikeouts while Anthony Rizzo connects on a triple.
Does Anderson deserve suspension for scrum with Keller?
Michael Wilbon and Tony Kornheiser discuss Tim Anderson's 1-game suspension and the use of one of the most controversial racial slurs in sports.
Orioles, Twins rained out; doubleheader Saturday
The Baltimore Orioles' game against the Minnesota Twins was rained out and rescheduled as part of a doubleheader Saturday starting at 4:05 p.m. EDT.
Hot Rays play host to struggling Red Sox
The Tampa Bay Rays are coming off of a tough loss to Baltimore Thursday night, but they are still sitting pretty atop the American League East as the Boston Red Sox come to town Friday.
Angels look to stop losing streak against Mariners, Gonzales
Seattle Mariners left-hander Marco Gonzales will try to continue his hot start to the season, and maintain his recent dominance against the Los Angeles Angels, when the teams meet in the second game of their four-game series on Friday night in...