The NL Central-leading Cardinals had won 15 of 18 and were trying for a three-game sweep. The Brewers ended a three-game skid.
Milwaukee got off to a fast start against Jack Flaherty (8-7), who had given up a total of just one run in his previous five starts.
Trent Grisham led off the first inning with a single, went to third on a throwing error by second baseman Kolten Wong and scored on a groundout by Hiura. Milwaukee made it 2-0 in the second inning when Ryan Braun doubled and later scored on Orlando Arcia’s sacrifice fly.
Hiura hit a solo home run in the fourth, sending a 3-0 fastball from Flaherty into the left-field seats. Hiura added an RBI double in the eighth.
Lyles (9-8), acquired from Pittsburgh in a trade on July 29, set the tone for Milwaukee. The right-hander, who had held Arizona hitless in a six-inning outing in his last start, struck out five of the first seven Cardinals he faced. He fanned nine in 5 1/3 innings.
Junior Guerra relieved Lyles with two on, got Yadier Molina to hit into a double-play and worked the ninth. Josh Hader struck out three in two scoreless innings to earn his 26th save.
Molina hit two singles and went 7 for 11 in the series. He homered three times in the first two games — the veteran catcher has just seven home runs this season.
Wong hit his 10th homer, connecting in the sixth off Lyles. He also doubled and singled.
Christian Yelich singled and walked in four plate appearances. The reigning NL MVP hasn’t hit a home run in 10 games, his longest drought of the season for Milwaukee.
Cardinals: Wong returned to the starting lineup. He had not started for three games after fouling a ball of his right big toe Saturday. “You get your toenail drilled to release blood, that can’t feel real great,” manager Mike Shildt said. “I appreciate and respect, and it is very important, his mentality to want to stay and get back to competition.”
Brewers: 3B Mike Moustakas said there is no timetable for his return. He has been out since leaving Monday’s game in the third inning with pain in his left palm and wrist after being struck by hard-hit groundball.
Cardinals: A three-day, four-game series against the Reds starts Friday in St. Louis. Cardinals RHP Dakota Hudson (13-6, 3.47 ERA) faces Reds RHP Trevor Bauer (10-11, 4.34 ERA) in the opener. Saturday features a day-night double-header.
Brewers: A three-game series against the Cubs in Chicago begins Friday. Brewers RHP Chase Anderson (6-3, 4.34 ERA) faces Cubs LHP José Quintana (11-8, 4.05 ERA).