MILWAUKEE -- - Paul Goldschmidt homered twice, and the St. Louis Cardinals overcame a five-run deficit to beat the Milwaukee Brewers 8-5 on 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.
St. Louis loaded the bases with one out 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 [to], 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."
Goldschmidt added his 29th homer in the ninth off Ashby.
T.J. McFarland (4-1) pitched a one-hit seventh, Luis García 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 past 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. I was trying to not let that affect pitch count, pitch selection," Wainwright said. "Or, the other team is going, 'I'm not going to be 2,000.' There might have been a little bit of that."