Martinez had control issues in his four-inning stint. He allowed four runs and seven hits, walked three, hit a batter and was called for a balk. He also had to dodge several up-the-middle hits by Brewers batters.
"He was having a tough time finding anything. It was one of those days that you are going to see from a young pitcher every once in a while," manager Mike Matheny said. "He's trying to harness his emotions a little bit. It was a rough day for him. It's one of those learning points."
It marked the seventh career start for the 22-year-old Martinez. Although he faced the Brewers for the first time as a starter, he has had success against Milwaukee, having pitched 9 2/3 scoreless innings of relief over seven appearances.
"I tried to control my emotions today, but it was hard because of all of those hits," he said through an interpreter.
After hitting a ground ball in the third inning, Martinez launched his bat high into the air, nearly striking the home-plate umpire.
"I tried to throw the bat to the ground. I don't know if it was emotion," Martinez said. "I went to the umpire and said I was sorry. It was just frustration."
Martinez needs to keep his emotions more in check on the field, Matheny said.
"We don't want to take all the emotions out of our players. Whatever the reason, it was wrong and he went out and apologized to the umpire. There's not a good excuse. He knows he needs to go out and play under control."
The Brewers jumped on Martinez for two runs in the first inning. After he allowed back-to-back singles to Carlos Gomez and Scooter Gennett to start the game, Ryan Braun blooped a hit over the head of first baseman Matt Adams. Gomez scored easily and Gennett crossed the plate after Braun was thrown out attempting to advance to second base. Martinez gave up four hits in the first.
Martinez walked three batters in the third, but also recorded three strikeouts. He whiffed Khris Davis with the bases loaded to end the inning.
The Cardinals cut the Brewers margin to 2-1 in the fourth when leadoff hitter Kolten Wong struck out, but reached first on a passed ball. Wong stole second and later scored on Adams' groundout.
The Brewers extended their lead in the fourth on Gennett's two-out, two-run double. Seth Maness replaced Martinez to start the fifth and gave up a home run to Davis, the first batter he faced.
The Brewers blew open the game in the sixth with run-scoring singles by Gomez, Braun and Aramis Ramirez. With the win, the Brewers are in first place at the All-Star break for only the fourth time in franchise history. Milwaukee added another run in the seventh on Gomez's double and two more in the eighth on a groundout and an RBI single by Lyle Overbay.
The Cardinals tacked on a run in the ninth off Brewers closer Francisco Rodriguez on an RBI groundout by George Kottaras.
The Cardinals managed just two runs after scoring 17 in the first two games of the series.
"We played two great games. Those are games that do take some life out of you, too," Matheny said. "It takes a lot of energy. It's perfect time for the break. There are going to be days like this. You've got to let them go and I anticipate that we will see a well-rested and ready group when we get back."
Brewers starter Wily Peralta turned in a stellar outing, holding the Cardinals to one unearned run and three hits over seven innings.
"He kept the ball down," said Wong, who had a first-inning single off Peralta. "They had a good game plan today."
The Brewers head into the break on a high note.
"It makes the break a lot finer," Brewers' manager Ron Roenicke said. "You wouldn't think that one game does, but it does. You're on a losing streak, if you lose today, you're not sure when the streak is going to end. So you go into the break not feeling good and you come out of the break not feeling good."
Elian Herrera had a career-high five hits for the Brewers.
Matheny expects the Cardinals and Brewers to battle for the top spot for the remainder of the season.
"They are going to continue to compete and so are we," he said.