The Cardinals hold a two-game lead over Cincinnati and Pittsburgh. The Reds downed the Pirates 6-5 in 10 innings to move into a tie for second place.
Former Brewers closer John Axford (7-7 ) picked up the win, while Carlos Martinez got his first save of the year for the Cardinals.
Beltran's fly ball to deep right field off Michael Blazek (0-1) scored Kolten Wong, who led off the 10th with a walk.
Matt Adams smacked a towering two-run, ninth-inning home run to give the Cardinals a 6-4 lead, but the Brewers rallied for two runs in the bottom of the frame to tie the game.
Jeff Bianchi hit a lead-off double and later scored on a single by pinch-hitter Logan Schafer. The Brewers added another run on Aramis Ramirez's slow roller off Axford, whom the Cardinals acquired from the Brewers earlier this season. Carlos Gomez grounded into an inning-ending double play to send the game to extra innings.
Adam's blast to right-center field came off Brewers' closer Jim Henderson, who walked Matt Holliday to start the inning.
The Cardinals jumped on Brewers' starter Johnny Hellweg for a run in the first inning on Matt Holliday's single.
Ramirez hit a three-run home run with one out in the Brewers' half of the first off Shelby Miller, who entered the game having given up just three earned runs over 25 innings in four previous starts against the Brewers this season.
Holliday's run-scoring single in the fifth cut the Brewers' lead to 3-2. Ramirez's sacrifice fly in the Brewers' half of the frame allowed Milwaukee to regain a two-run lead.
Matt Carpenter and Beltran connected for back-to-back doubles in the seventh to cut the lead to 4-3. Adams' run-scoring single tied the game.
The Brewers had a chance to regain the lead in their half of the seventh, but Beltran threw out Norichika Aoki at the plate as he tried to score from second on a single by Ramirez.
Hellweg gave up seven hits and two runs over in an erratic five-inning stint. He walked five, struck out one, hit a batter and threw a wild pitch.
Miller surrendered seven hits and four runs in six innings. He walked two and struck out four.
Aoki had four hits, a walk and scored three runs for the Brewers.
NOTES: The Cardinals ran their record to 7-1 at Miller Park this season and 13-4 overall against the Brewers. . Shelby Miller became the first St. Louis rookie pitcher to start 30 games in a season since Rick Ankiel in 2000. . With four strikeouts, Miller passed Harvey Haddix for third place on St. Louis' rookie strikeout list with 166. . St. Louis wraps up its final regular-season road trip with the three-game series in Milwaukee.