Martin's sharp grounder off Trevor Rosenthal (1-2) rolled into left field, giving Walker enough time to score from second. The Pirates' fourth straight win over the Cardinals gave Pittsburgh a 2 1/2-game lead in the NL Central.
St. Louis left 11 runners on base and dropped its seventh consecutive game. The Cardinals led 2-0, 3-1 and 4-2.
Tony Watson (3-1) worked two shutout innings in relief. Mark Melancon pitched a perfect ninth for his fifth save.
Matt Holliday had three hits and drove in two runs, and the Cardinals' struggling offence put together 13 hits.
BRAVES 9, ROCKIES 0
ATLANTA (AP) — Mike Minor allowed only two hits in seven scoreless innings, Brian McCann hit a three-run homer in a seven-run third, and Atlanta beat Colorado for its sixth straight win.
Freddie Freeman drove in two runs with four hits as the Braves continued their offensive surge with 15 hits. The Braves have scored 29 runs while winning the first three games of the four-game series.
The Braves lead second-place Washington by 11 games in the NL East, their biggest advantage in nine years.
Minor (11-5) didn't walk a batter and didn't allow a Colorado baserunner to reach second base.
Tyler Chatwood (7-4) allowed a career-high seven earned runs on 10 hits, one walk and one hit batter in only 2 1-3 innings.
Colorado's Carlos Gonzalez left the game in the fourth inning after aggravating his sprained right middle finger.
GIANTS 9, PHILLIES 2
PHILADELPHIA (AP) — Chad Gaudin threw seven sharp innings, Brett Pill and Brandon Crawford hit homers, and San Francisco snapped a five-game losing streak with the victory over Philadelphia.
The defending World Series champion Giants are last in the NL West. The Phillies entered 11 1/2 games out of first place and fell to nine back in the wild-card standings.
Gaudin (5-2) allowed one run and four hits, striking out five. He also got his first career RBI on a single that was just his second hit in 59 at-bats.
Roger Kieschnick had RBI singles in his first two major league at-bats for the Giants, who snapped a nine-game homerless drought when Pill went deep. Pill had three hits and four RBIs.
Kyle Kendrick (9-8) gave up eight hits and seven runs in two-plus innings.
REDS 4, PADRES 1
SAN DIEGO (AP) — Homer Bailey came within two outs of a five-hit shutout to end his four-start losing streak and Cincinnati beat San Diego to snap a five-game skid.
Brandon Phillips homered and Joey Votto hit a two-run double for the Reds, who avoided a three-game sweep and ended the Padres' four-game winning streak.
Bailey had allowed just five singles going into the ninth, when Everth Cabrera reached on a fielding error by first baseman Votto leading off the inning. The right-hander got Chris Denorfia to fly out before Chase Headley doubled in Cabrera. Manager Dusty Baker pulled Bailey, and Aroldis Chapman got the final two outs for his 25th save in 29 chances.
Bailey (6-10) allowed six hits and one unearned run, struck out seven and walked none.
Phillips homered to centre field off lefty Eric Stults (8-10) leading off the second, his 13th.
MARLINS 3, METS 2
MIAMI (AP) — Jake Marisnick hit his first major league home run and Henderson Alvarez pitched into the eighth inning to lead Miami over New York.
Giancarlo Stanton and Placido Polanco also drove in a run each for the Marlins, who dropped the first two games of the four-game series with the Mets.
Mike Dunn got four outs for his second save in place of Steve Cishek, who pitched two innings and took the loss in Tuesday's 4-2 loss to New York.
Dunn issued a lead-off single to John Buck before retiring the next three batters to end the game.
Alvarez (2-1) allowed two runs and six hits in 7 1-3 innings. He is 2-0 with a 1.33 ERA in his last four starts.
Marisnick homered off of Jenrry Mejia (1-1) in the second inning to give the Marlins a 1-0 lead. The 22-year-old rookie was hitting .179 (5 for 28) in his first eight games before the home run.
CUBS 6, BREWERS 1
CHICAGO (AP) — Edwin Jackson pitched eight solid innings, David DeJesus drove in three runs and Chicago beat Milwaukee to salvage the finale of the four-game series.
Anthony Rizzo hit a two-run homer and Starlin Castro belted a solo shot as Chicago closed out a 14-13 July, its first winning calendar month since it went 15-10 last July. Jackson allowed one run and eight hits in his longest outing of the season, staying in the game after a 66-minute rain delay in the sixth inning.
Jonathan Lucroy had two doubles for Milwaukee, driving in Rickie Weeks with a grounder down the first-base line in the eighth. Jeff Bianchi and Caleb Gindl also had two hits apiece.
Rizzo went deep in the third, driving a 3-1 pitch from Wily Peralta (7-11) over the wall in centre for his 15th homer — matching his career high set a year ago. Castro connected an inning later, making it 3-0 with a drive to the bleachers in left.
Jackson (7-11) struck out four and walked none. The right-hander finished July with a 3-1 record and a 1.83 ERA in five starts.
LOS ANGELES (AP) — Pinch-hitter Lyle Overbay singled in the go-ahead run with two outs in the top of the ninth inning, helping New York defeat Los Angeles.
Overbay singled on a 1-2 pitch from Paco Rodriguez. Robinson Cano scored after reaching on a fielder's choice groundout.
The Yankees added two more runs on an error by Dodgers second baseman Mark Ellis.
Ronald Belisario (4-6) got two outs in the ninth inning, but took the loss. He walked Derek Jeter and pinch-hitter Ichiro Suzuki, who both scored after Belisario was relieved by Rodriguez.
Boone Logan (3-2) got the win in relief.
Mariano Rivera pitched the ninth to earn his 34th save in 36 chances in his farewell season.