MILWAUKEE: Pinch-hitter Travis Snider homered in the ninth inning to lift Pittsburgh to a 4-3 win over the Milwaukee Brewers on Tuesday night that clinched the Pirates’ first non-losing record in 21 seasons.

Snider drove a 2-2 pitch from Jim Henderson (3-5) over the wall in center for his second pinch-hit homer of the season. He also accomplished the feat against the Chicago Cubs on May 21.

It was victory No. 81 for Pittsburgh, ensuring it will not finish with a losing record for the first time since it went 96-66 in 1992. More importantly, it boosted the Pirates’ lead in the NL Central to two games over St. Louis.

Vin Mazzaro (7-2) pitched two innings for the win and Mark Melancon got three outs for his 11th save, striking out Khris Davis with a runner on second to make it four straight wins for Pittsburgh at Miller Park for the first time since 2002.

Reds 1 Cardinals 0: In Cincinnati, Speedy Billy Hamilton got his first major league steal and came around on Todd Frazier’s double in the seventh inning, sending Cincinnati to the victory.

Hamilton made his big league debut as a pinch runner for Ryan Ludwick, who led off the seventh with a single against Seth Maness (5-2).

After Maness threw to first three times, Hamilton took off and beat catcher Yadier Molina’s off-target throw. The touted prospect scored easily on Frazier’s hit and got congratulatory slaps in the dugout.

Homer Bailey (10-10) allowed only two hits in seven innings, retiring his last 14 batters. Aroldis Chapman got three outs for his 34th save in 39 chances, completing the two-hitter.

Dodgers 7 Rockies 4: In Denver, Ricky Nolasco pitched six strong innings, Carl Crawford had three hits and the Dodgers earned their sixth consecutive win.

Crawford singled in a pair of runs in the second to spark the offense in the absence of injured catalyst Yasiel Puig. The Cuban slugger was rested a day after he aggravated a right knee strain.

Nolasco (12-9) allowed two runs and five hits in improving to 7-1 with a 2.27 ERA in 11 starts since coming to Los Angeles on July 6 in a

Nationals 9 Phillies 6: In Philadelphia, Wilson Ramos hit a three-run homer and Corey Brown also went deep to back Gio Gonzalez, leading Washington to the victory.

Still clinging to post-season hopes, the Nationals overcame a sloppy all-around effort that included three errors, four unearned runs and four wild pitches. They remained 7 1/2 games behind Cincinnati for the second wild-card spot.

Gonzalez (9-6) gave up five runs — one earned — and five hits, striking out six in 5 2-3 innings.

.

Braves 3 Mets 1: In Atlanta, Kris Medlen pitched seven strong innings to help Atlanta get another win at home.

Andrelton Simmons and Evan Gattis homered for the Braves, who have won 20 of 24 at Turner Field to improve the major leagues’ best home record to 51-19.

Gattis, who was recalled earlier in the day after a three-game stint at Triple-A Gwinnett, tied it at 1 with his 16th homer in the seventh. After Mets starter Carlos Torres (3-3) walked Dan Uggla on nine pitches, Simmons hit his 13th homer to make it 3-1.

Medlen (12-12) allowed seven hits and one run while striking out nine.

Padres 3 Giants 2: In San Diego, Chris Denorfia hit a go-ahead RBI single in the seventh inning to lift the Padres to the victory.

Nick Hundley drew a leadoff walk in the seventh from rookie reliever Jake Dunning, who was called up earlier in the day from Triple-A Fresno. Ronnie Cedeno followed with a single to send Hundley to third and bring on Javier Lopez.

Denorfia lined a 1-2 pitch to left for the single that broke a 2-all tie.

Marlins 6 Cubs 2: In Chicago, Donovan Solano had three hits, including a two-run double, and the Miami bullpen combined for 4 2-3 hitless innings.

Christian Yelich drove in three runs with a double and single for the Marlins, who have won three straight after losing six in a row.

Brian Bogusevic hit a solo homer for the Cubs, who dropped to 27-44 at Wrigley Field.

Interleague

Blue Jays 10 Diamondbacks 4: In Phoenix, Edwin Encarnacion, Rajai Davis, Adam Lind and Moises Sierra homered in Toronto’s fifth win in six games.

The Blue Jays jumped out to a 5-0 lead against Wade Miley (9-10). Todd Redmond (3-2) allowed three runs and four hits in five innings for his second win in a row.

The Diamondbacks have lost three straight and five of six, all at home. Adam Eaton, Didi Gregorius and Miguel Montero went deep for Arizona.

Encarnacion also doubled, singled and walked twice.