MILWAUKEE (AP) -- This one was for Roberto Clemente. The Hall of Famer's retired jersey is still the only 21 that matters for the Pittsburgh Pirates.
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 two decades.
Clemente played right field for Pittsburgh and finished his career with exactly 3,000 hits. He died in a plane crash on New Year's Eve 1972 while trying to deliver food and relief supplies to earthquake victims in Nicaragua.
''The one family I'm happy for is the Clemente family,'' manager Clint Hurdle said. ''They told me earlier in the season that we can't have 21 losing seasons, that we've got to find a way to not have Roberto's number tied to that. I told them we'd find a way to take care of that. It's been taken care of.''
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.
''It was on our to-do list,'' Hurdle said. ''We'll move on from here. Our plans are continue to play and compete and go further.''
Mark Melancon pitched the ninth 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. The Pirates lost 44 of 51 games in Milwaukee from 2007-2012.
''We've played good baseball all year,'' Snider said. ''To have the veterans that we've picked up, and you add them into the mix with the guys that have grinded all year, brings some great personality, some great veteran leadership and overall great players.''
Pittsburgh went ahead 3-2 in the eighth. Andrew McCutchen walked with one out and raced around to third when newly acquired Justin Morneau followed with a perfectly executed hit-and-run single into left field. Marlon Byrd then hit an RBI double off Brandon Kintzler into the left-field corner.
Pinch-hitter Pedro Alvarez was intentionally walked to load the bases with two outs, and Kintzler got pinch-hitter Gaby Sanchez to fly out to end the threat.
Morneau, who was acquired in a trade with Minnesota on Saturday, had three hits. Byrd, who came over in last week's deal with the New York Mets, went 2 for 3 with two RBIs and has hit safely in six of his first seven games with Pittsburgh.
Snider said the addition of Morneau and Byrd has supplied a big boost.
''I think all of us are fortunate and blessed to have those guys on this team,'' he said. ''To help us as a squad, the city of Pittsburgh and the fans that have been grinding for the last 20 years, give them something to be excited about and make a push on this thing.''
Jean Segura had two hits and Jonathan Lucroy drove in two runs for Milwaukee, which has lost five in a row.
Lucroy shared Henderson's misery.
''He (Snider) had fouled that fastball off pretty good right before that pitch,'' Lucroy said. The catcher was thinking ''let's throw a slider right here and keep it down. He'll probably swing at it, if it's down,'' he said.
Problem was the pitch sailed in high.
''He just hung it right into his swing,'' Lucroy said. ''I called those pitches that got hit out. I share the blame myself.''
The Brewers rallied in the bottom half of the eighth against Vin Mazzaro (7-2). Pinch-hitter Caleb Gindl walked, advanced on a groundout and scored on Segura's base hit.
Yovani Gallardo pitched seven solid innings for Milwaukee, allowing two runs and five hits. The right-hander, who threw seven shutout innings at Pittsburgh in his previous start, is 11-4 with a 2.59 ERA in 20 career appearances against the Pirates.
McCutchen went deep with two out in the first for his 18th homer of the season and No. 100 for his career. But Milwaukee responded with two runs against Gerrit Cole in the bottom half on Lucroy's two-run single to right.
Cole gave up five hits over six innings. He struck out five and walked one.
NOTES: Pittsburgh activated closer Jason Grilli from the disabled list. The 36-year-old right-hander had been on the DL since straining the right flexor tendon in his pitching arm during a 6-5 victory over Washington on July 22. He had been on a rehab assignment in the minors before being recalled. Hurdle said Grilli will make a couple of relief appearances in non-save situations before resuming his role as the closer. He made the All-Star team for the first time this season and was second in the NL with 30 saves at the time of his injury. ... The Pirates recalled RHP Jared Hughes, OF Andrew Lambo, LHP Jeff Locke and C Tony Sanchez from Double-A Altoona. ... The Brewers recalled 1B/OF Sean Halton and RHP Johnny Hellweg and selected the contract of RHP Jimmy Nelson from Triple-A Nashville. ... The Pirates have homered 12 times in their last 12 games. ... McCutchen is the sixth player in team history to hit at least 100 home runs and steal at least 100 bases in his career.