Jimmy Nelson is in the midst of the best year of his career, though the emerging ace of the Milwaukee Brewers had yet to solve the St. Louis Cardinals.

That changed Tuesday, as Nelson finally beat St. Louis with six strong innings in the Brewers' 3-2 victory.

Nelson (9-5) entered 0-8 with a 7.01 ERA in 11 appearances (10 starts) against the Cardinals. This time, the right-hander overcame his division rival by allowing just two runs on six hits with seven strikeouts.

"It is definitely nice to finally get one," Nelson said.

The Brewers' bullpen kept the Cardinals off the scoreboard for three innings, including Anthony Swarzak striking out the side in the eighth after Josh Hader issued a leadoff walk.

Left fielder Ryan Braun and shortstop Orlando Arcia collided and allowed Stephen Piscotty to reach on a single with one out in the ninth, but Corey Knebel worked around the miscue to earn his 19th save.

The Brewers scored their three runs in the first inning off Cardinals starter Carlos Martinez (7-9) and had just two infield singles the rest of the game.

Eric Sogard scored on a groundout by Braun, and Domingo Santana snapped Milwaukee's 0-for-33 skid with runners in scoring position with a two-out RBI single up the middle. Manny Pina followed with a double to center to plate Santana and make it 3-0.

"You're facing Carlos Martinez, so you know runs are going to be tough to begin with," Brewers manager Craig Counsell said. "We got him before he settled in, really."

A two-out RBI single by Yadier Molina and another by Tommy Pham in the fifth pulled St. Louis within 3-2.

Nelson worked out of the inning by getting Paul DeJong to fly out with two on and then pitched a scoreless sixth.

Martinez settled in to get through five innings. He escaped further damage in the fifth by inducing a grounder to third base by Santana with the bases loaded.

First-inning struggles are nothing new to Martinez, who has a 6.55 ERA (16 runs in 22 starts) in opening frames, by far his highest in any inning. After the game, he hinted at potentially changing his warmup routine.

"I throw all my pitches at game speed," Martinez said through a translator. "I try to stay focused and try to treat my warmups as I was pitching an inning during the game. Now I think it's more of an issue of staying in control mentally and that's something I need to work on."

PLAY AT THE PLATE

The Cardinals thought they had a run on the board and a big inning brewing in the third when Randal Grichuk roped a double into the left-center field gap with Kolten Wong on first base.

Wong was sent home, but the Brewers executed a perfect relay from Braun to shortstop Orlando Arcia to Pina.

"In my mind, I didn't think we (had a play)," Pina said. "When Wong touched third base and Arcia got the ball, I said, 'OK, maybe we have a chance here.'"

TRAINER’S ROOM

Cardinals: RHP Adam Wainwright (mid-back tightness) threw off flat ground Tuesday and is slated to throw a bullpen session Wednesday. RHP Luke Weaver will start in his place Wednesday against the Brewers, with Wainwright potentially being inserted into the rotation before his next scheduled turn. ... St. Louis activated Piscotty from the disabled list before the game and optioned OF Harrison Bader to Triple-A Memphis.

UP NEXT

Cardinals: RHP Luke Weaver (0-1, 4.50 ERA) will make his second start of the season in place of the injured Wainwright. He allowed four runs in five innings in a 4-0 loss to Arizona on July 27.