MILWAUKEE — Stephen Piscotty watched Jonathan Villar’s throw skid past first base, then sprinted 180 feet to give the St. Louis Cardinals a victory.

Piscotty scored on a throwing error in the ninth inning after Carlos Martinez struck out a career-high 13, leading the Cardinals over the Milwaukee Brewers 6-5 on Monday night.

With two on and nobody out in the ninth, Yadier Molina dropped down a bunt. Reliever Tyler Thornburg (5-5) threw to third base for a force out, but Villar’s throw to first was wild, allowing Piscotty to score from second.

“Put pressure on them,” Cardinals manager Mike Matheny said. “That’s it. Make them make plays.”

The Cardinals maintained a slim lead over Pittsburgh for the second NL wild card.

It was Villar’s 25th error and his eighth since moving from shortstop to third base to accommodate rookie shortstop Orlando Arcia.

“He just made a bad throw,” Brewers manager Craig Counsell said. “We talked about that situation out there and the possibility for a double play. He just rushed it a little bit probably. The big out was to get the out at third. We just didn’t make the play.”

After Martinez held Milwaukee to one run over six innings, the Brewers scored four runs in the seventh to take a 5-3 lead. St. Louis tied it in the eighth on a two-run homer by Randal Grichuk off Corey Knebel.

Seung Hwan Oh pitched a perfect ninth for his 14th save. Miguel Socolovich (1-0) worked 1 2/3 scoreless innings to pick up his first win.

The Cardinals took the lead on a sacrifice fly by Wong in the fourth. Jedd Gyorko homered in the fifth and Kolten Wong hit a solo shot in the fifth for a 3-1 advantage.

Martinez allowed four hits and walked two while throwing 98 pitches. He struck out eight of the first 11 batters and didn’t allow a hit to the outfield until the sixth.

“I really tried working hard on my breaking ball and that’s what I tried to stay focused on,” Martinez said through a translator. “I didn’t do anything different. I know that the balls can go far (in Miller Park), and I know that they’re looking for a four-seamer, so I just try to switch it up and confuse them.”

Arcia began the four-run seventh with a homer off Matt Bowman. Villar had an RBI double, and then Milwaukee went ahead on an RBI infield single by Scooter Gennett. The Brewers sent 10 batters to the plate against three relievers during the inning.

However, Milwaukee squandered a chance to extend its lead. After Kevin Siegrist walked Hernan Perez to walk in a run, Socolovich came on to strike out Chris Carter and get Kirk Nieuwenhuis to pop out to shortstop.

It was a mistake-filled loss for the Brewers. A botched rundown led to St. Louis’ first run and the winning run scored on what should have been an inning-changing double play.

Milwaukee also set a franchise record for most strikeouts in a nine-inning game with 19.

“We’re playing these teams fighting for playoff spots,” Counsell said. “We just didn’t do quite enough right. We have to capitalize on every single opportunity, defensively and offensively.”

Brewers starter Zach Davies (10-7) matched his career high with nine strikeouts but gave up three runs and seven hits over 6 1/3 innings.

RELIEVER RECALLED

The Cardinals recalled LHP Dean Kiekhefer from Triple-A Memphis to fill the roster spot of RHP Mike Leake, who was placed on the 15-day disabled list.

TRAINER’S ROOM

Cardinals: Leake’s placement on the disabled list is retroactive to Aug. 22. He is eligible to return Sept. 6. With Leake sidelined, rookie RHP Alex Reyes will remain in the rotation for at least one more turn.

Brewers: Brewers RHP Junior Guerra (right elbow) will return from the disabled list to start Friday in Pittsburgh.

UP NEXT

Cardinals: RHP Adam Wainwright (9-8, 4.67 ERA) will look to continue his career dominance of the Brewers on Tuesday. The veteran is 13-8 with a 2.23 ERA in 33 games against Milwaukee.

Brewers: RHP Wily Peralta (5-9, 5.87) will make his 18th start of the season when he faces the Cardinals on Tuesday. Peralta is 1-2 with a 3.52 ERA in four starts since being recalled from Triple-A Colorado Springs on Aug. 8.