Mike Moustakas hit a two-run double, Jhoulys Chacin beat St. Louis for the first time in his career and the Milwaukee Brewers edged the Cardinals 2-1 on Sunday.

Milwaukee (69-57) snapped a three-game losing streak and moved back ahead of St. Louis (68-57) for the second National League wild card. The Cardinals lost for just the second time in their last 12 games.

Chacin (13-4) entered the game 0-7 with a 6.90 ERA in nine career games against the Cardinals, but shut them out through six innings as the Brewers avoided their first three-game sweep at St. Louis since July 1-3, 2016.

Milwaukee Brewers starting pitcher Jhoulys Chacin throws during the first inning of a baseball game against the St. Louis Cardinals, Sunday, Aug. 19, 2018, in St. Louis. (AP PhotoJeff Roberson)

Milwaukee Brewers starting pitcher Jhoulys Chacin throws during the first inning of a baseball game against the St. Louis Cardinals, Sunday, Aug. 19, 2018, in St. Louis. (AP PhotoJeff Roberson)

Chacin has won his last three starts and has given up three runs in his last 19 innings. The Brewers improved to 19-8 in his starts this season.

Jeremy Jeffress gave up a run in two innings of relief and Josh Hader pitched a perfect ninth to earn his 10th save in 13 opportunities for the Brewers.

Moustaskas hammered an 0-2 pitch down the first-base line to score Orlando Arcia and Lorenzo Cain, giving the Brewers a 2-0 lead in the third. Arcia and Cain each stole a base to help get them into scoring position ahead of Moustaskas.

Milwaukee Brewers' Mike Moustakas, bottom, is out at second as St. Louis Cardinals second baseman Greg Garcia, top, turns a double play during the eighth inning of a baseball game Sunday, Aug. 19, 2018, in St. Louis. Brewers' Jesus Aguilar was out at first. (AP PhotoJeff Roberson)

Milwaukee Brewers' Mike Moustakas, bottom, is out at second as St. Louis Cardinals second baseman Greg Garcia, top, turns a double play during the eighth inning of a baseball game Sunday, Aug. 19, 2018, in St. Louis. Brewers' Jesus Aguilar was out at first. (AP PhotoJeff Roberson)

John Gant (5-5) gave up two runs on six hits and two walks in 4 1/3 innings. Gant has failed to make it past 4 1/3 innings in three of his last four starts.

Brett Cecil pitched out of a bases-loaded jam in the fifth, Tyson Ross followed with three scoreless innings and Mike Mayers added another as Cardinals relievers combined for 4 2/3 shutout innings.

Patrick Wisdom hit his first career home run 414 feet into the bleachers in left-center to lead off the eighth for St. Louis.

Milwaukee Brewers' Mike Moustakas, left, and Jesus Aguilar celebrate a victory over the St. Louis Cardinals at a baseball game Sunday, Aug. 19, 2018, in St. Louis. (AP PhotoJeff Roberson)

Milwaukee Brewers' Mike Moustakas, left, and Jesus Aguilar celebrate a victory over the St. Louis Cardinals at a baseball game Sunday, Aug. 19, 2018, in St. Louis. (AP PhotoJeff Roberson)

IRONMAN

Yadier Molina started his 27th straight game, a major league record for catchers 35 years or older.

TRAINING ROOM

Milwaukee: C Manny Pina (left shoulder) missed his third straight game and is day-to-day.

St. Louis Cardinals' Matt Carpenter, left, is safe at first on a bunt single as Milwaukee Brewers first baseman Jesus Aguilar handles the throw during the sixth inning of a baseball game Sunday, Aug. 19, 2018, in St. Louis. (AP PhotoJeff Roberson)

St. Louis Cardinals' Matt Carpenter, left, is safe at first on a bunt single as Milwaukee Brewers first baseman Jesus Aguilar handles the throw during the sixth inning of a baseball game Sunday, Aug. 19, 2018, in St. Louis. (AP PhotoJeff Roberson)

Cardinals: 2B Kolten Wong (bruised elbow) pinch hit and flew out after being taken out of Saturday night's game. RHP Carlos Martinez (right shoulder strain) and IF Yairo Munoz (right wrist sprain) were scheduled to play Sunday at Double-A Springfield and could join the team in Los Angeles.

UP NEXT

Milwaukee: RHP Chase Anderson (7-7, 3.97 ERA) will start a three-game series against the visiting Cincinnati Reds and RHP Homer Bailey (1-10, 6.33 ERA) on Monday night. Anderson is 4-1 with a 2.98 ERA in nine career starts against the Reds.

Cardinals: LHP Austin Gomber (3-0, 2.89 ERA) will kick off a six-game road trip Monday night against the Los Angeles Dodgers and LHP Alex Wood (7-7, 3.51 ERA). Gomber has won his last two starts and has an 11-inning scoreless streak.

More AP MLB: https://apnews.com/tag/MLB and https://twitter.com/AP_Sports