MILWAUKEE (AP) Paul Goldschmidt homered twice, and the St. Louis Cardinals overcame a five-run deficit to beat the Milwaukee Brewers 8-5 Thursday and extend their longest winning streak in 39 years to 12 games.
On a day Adam Wainwright faltered early, St. Louis trailed 5-0 before rallying with one run in the fifth, four in the seventh, two in the eighth and one in the ninth.
''They picked me up big time today,'' Wainwright said of his teammates. ''Goldie hit some really good swings. I gave him a big old smooch on the top of his head, and I don't care who knows it.''
The Cardinals maintained a 4 1/2-game lead over Philadelphia for the second NL wild card, with Cincinnati another game back.
''It was a great team win,'' Wainwright said. ''I put us in a hole, and they came back and won that game.''
St. Louis began its winning streak by overcoming a four-run deficit against Cincinnati to win on Sept. 11. The Cardinals are on their longest winning streak since April 11-24, 1982, and are two shy of the franchise record set in 1935.
Milwaukee has lost five in a row since clinching its fourth consecutive playoff berth on Sept. 18, including four defeats to the Cardinals.
Yadier Molina started the comeback with an RBI single in the fifth off Adrian Houser.
St. Louis loaded the bases with one outs in the seventh on two walks and a single against Jake Cousins, and Tommy Edman hit an RBI grounder off Brad Boxberger, whose throwing error on a pickoff attempt brought in another run. Goldschmidt tied the score with a two-run homer.
''I was able, fortunately, get a ball out of there and tied up the game,'' Goldschmidt said. ''It was a great job by the lineup that the next inning continuing to add on and get two more runs.''
Nolan Arenado walked against Aaron Ashby (3-1) leading off the eighth and scored on Manny Pina's passed ball for a 6-5 lead. Molina added a sacrifice fly.
Goldsdmidt added his 29th homer in the ninth off Ashby.
T.J. McFarland (4-1) pitched a one-hit seventh, Luis Garcia threw the eighth and Giovanny Gallegos struck out two in a perfect ninth for his 12th save in 20 chances as four relievers combined for shutout relief.
Wainwright, who has won nine of his last 10 decisions, allowed five runs, four hits and two walks in four innings.
Tyrone Taylor hit a grand slam in the first inning and a solo shot in the fourth.
Wainwright joined Hall of Famer Bob Gibson as the only St. Louis Cardinals' pitchers with 2,000 strikeouts, fanning Milwaukee's Luis Urias in the fourth inning.
The 40-year-old right-hander became the ninth active pitcher with 2,000. Gibson got his 2,000th strikeout when Pittsburgh's Roberto Clemente was called out on July 13, 1969. Gibson, who died last October, finished with 3,117..
''Today, I knew I just needed one,'' Wainwright said. ''I was trying to not let that effect pitch count, pitch selection,'' Wainwright said. ''Or, the other team is going, `I'm not going to be 2000'. There might have been a little bit of that.''
Cardinals: Arenado, who left in the fifth inning Wednesday night with lower back tightness, started at third and went 0 for 3 with a walk. Cardinals manager Mike Shildt said that Arenado had a treatment on his back after the game and then this morning and declared himself ready to go.
Brewers: RP Devin Williams was unavailable. ''Devin injured his calf two days ago running in the outfield,'' manager Craig Counsell said. ''We're trying to get him through without an IL placement.'' ... Pina took a foul tip off Wainwright's bat off the top of his left shin pad. After a short delay, he remained in the game. . RF Avisail Garcia was scheduled for a day off, but pinch hit for Houser in the sixth and grounded out.
GET A NEW GLOVE
Before Cousins threw a pitch in the seventh, the umpires made him switch gloves. Counsell came out to join the discussion. ''The umpires noticed it. It wasn't his normal glove he was using today. It was a pretty white glove, so they switched out,'' Counsell said. ''I understand why.''
Cardinals: LHP J.A. Happ (9-8, 6.02 ERA) opens a four-game road series as the Cardinals take on LHP Justin Steele (3-3,4.20 ERA) and the Chicago Cubs. It's the first time Happ has faced the Cubs since 2017. He is 1-5 with a 6.00 ERA in seven career starts against them, including 0-2 at Wrigley Field.
Brewers: LHP Eric Lauer (6-5, 3.03 ERA) opens the final regular season home series against RHP Tyler Megill (3-5, 4.57 ERA) and the New York Mets. It's Lauer's first outing against the Mets.
More AP baseball: https://apnews.com/hub/MLB and https://twitter.com/AP-Sports