ST. LOUIS — The Milwaukee Brewers did what they needed to on Friday night They didn’t get the help they needed from the Los Angeles Dodgers.

The Brewers, led by Chase Anderson’s pitching and Stephen Vogt’s timely hitting, beat the St. Louis Cardinals 5-3 on Friday to keep their playoff hopes alive.

But Milwaukee, which entered the day two games behind the Colorado Rockies for the second Wild-Card spot in the National League, is still two games back after the Rockies beat the Dodgers 9-1 on Friday.

“We’re alive,” Brewers manager Craig Counsell said. “We’re alive with two days to go, so we’ll take it and we’ll have fun playing tomorrow and know that it means something.”

Milwaukee, which has won four of its last six games, needs to win the final two games of the season in St. Louis and needs the Dodgers to win the next two against the Rockies.

“We can’t control that,” Vogt said. “Obviously you’re looking up. But win tomorrow, take care of what we can take care of, and let the chips fall where they do.”

Anderson and Vogt did their part on Friday.

“We don’t win tonight without him,” Vogt said of Anderson. “He was outstanding. Biggest game of the year. Steps up, goes seven-plus. Really just threw the ball wherever he wanted tonight.”

Anderson (12-4) allowed three hits to earn his fourth win in his last five starts. The right-hander, who went 3-1 with a 2.25 ERA in six September starts, struck out five and walked one among 101 pitches.

“He’s had a good season,” Cardinals manager Mike Matheny said. “He’s a good pitcher. The breaking ball was working and he didn’t make a lot of mistakes. Just your typical solid outing.”

Vogt, who was acquired off waivers from the Oakland Athletics in late June, had two hits, including his 12th homer, and drove in three runs.

John Gant (0-1), who was making his second start of the season, allowed four runs and seven hits in five innings. He struck out three and walked three.

The Brewers scored first, with Vogt’s RBI single to left field scoring Travis Shaw in the second inning.

Vogt made it 2-0 with a home run, his 12th, to right field in the fourth inning.

Cardinals rookie shortstop Paul DeJong hit his 25th home run in the fourth. The home run was the 38th of the season for DeJong, who hit 13 for Triple-A Memphis before being promoted to the Cardinals.

The Brewers added two runs in the sixth, on a groundout by Vogt and a fielder’s choice by shortstop Orlando Arcia, to make it 4-1.

Eric Thames drove in a run with a single to right in the ninth for the Brewers.

Jose Martinez hit a two-run home run, his 14th, off Brewers closer Corey Knebel with two outs in the bottom of the ninth.

BLUES HONORED

The St. Louis Blues were introduced before the game, with leading scorer Vladimir Tarasenko throwing out the ceremonial first pitch. The Cardinals wore Blues-themed jerseys for batting practice.

TRAINER’S ROOM

Brewers: 1B Thames returned to the lineup after not playing Thursday. He bruised his right foot with a foul ball on Wednesday. … C Manny Pinna (strained left thumb) missed his seventh consecutive game.

Cardinals: C Yadier Molina (concussion protocol), 1B Matt Carpenter (shoulder), RHP Adam Wainwright (elbow), LHP Tyler Lyons (knee) have been shut down for the remainder of the season, the team announced. … 2B Kolten Wong (lower back tightness) was not in the lineup for his consecutive straight game.

UP NEXT

Brewers: RHP Junior Guerra (1-4, 4.90) is 1-2 with a 4.76 ERA in three career starts against the Cardinals.

Cardinals: RHP Luke Weaver (7-2, 3.23) will make his first start since allowing eight runs in three innings against the Cubs on Sept. 25. That loss snapped a string of seven consecutive victories for the rookie.