Headed toward another lost season, Pittsburgh acquired four minor leaguers -- top outfield prospect Jose Tabata, right-handers Ross Ohlendorf and George Kontos, and left-hander Phil Coke.
Two people familiar with the deal confirmed the trade on condition of anonymity because physicals were still pending.
"You never want to lose good guys as teammates but you know what? It's funny. We go through it every year here," Pirates starter Zach Duke said. "I'm sure it's something that made sense from a baseball standpoint.
"It's tough but you have to focus on the game and not worry about that stuff."
"We got a couple of breaks tonight, which we haven't been getting," manager Bud Black said. "When you make contact, things happen. That was a good thing for us tonight."
Nady was in right field during the top of the first but was replaced by Jason Michaels in the field in the second. Nady was told of the move in the on-deck circle in the first and called back into the dugout.
Marte, one of the most coveted left-handed specialists in the game, was caught by television cameras hugging teammates in the dugout after leaving the bullpen.
"It was emotional," manager John Russell said. "Guys were, I wouldn't say shocked, but it was kind of a situation where it happened rather quickly. It was a special moment in a lot of ways. You could feel the outpouring for those guys when they came to say their goodbyes. It was genuine feelings."
Adam LaRoche hit two solo homers to reach 100 for his career and scored three runs for the Pirates, who had won four straight.
Kevin Kouzmanoff singled with one out in the fourth and Gonzalez followed with his 23rd homer, giving San Diego a 3-1 lead.
"I thought Gonzo had some great at-bats," Black said. "That was indicative of what we've seen most of the season."
The Padres went ahead 5-2 in the sixth. Chase Headley singled in Giles and Bard drove in Gonzalez with a groundout.
Cha Seung Baek (3-4) allowed four runs and seven hits in 5 1-3 innings, winning for only the second time in nine starts for the Padres since being acquired from Seattle in May. Trevor Hoffman pitched a perfect ninth for his 19th save.
LaRoche went deep in the second and fourth for his eighth career multihomer game and first this season. He has 14 homers this season.
Duke (4-8) was charged with five runs and seven hits in six innings for the Pirates. He has lost his last three decisions and allowed 24 earned runs in his past 19 1/3 innings over four starts.
Pittsburgh scored twice in the sixth but lost out on an opportunity for more. Doug Mientkiewicz had a one-out RBI single and pinch-hitter Chris Gomez then singled in LaRoche. Mientkiewicz was thrown out trying to advance to third on Gomez's hit, and the Padres also retired Gomez trying to reach second.
"We haven't had a ball go our way the whole lot this year, so to get a 4-5-6 double play, or whatever it was, you don't see that too often," Headley said. "It was definitely a little unusual, but we'll take it anyway we can."
Kouzmanoff added an RBI single off Tyler Yates in the seventh.
"You could sense it in the eighth," Russell said. "These guys they knew they had to come together. We were two players short tonight. You could feel the intensity and the focus, and unfortunately we lost. But (this team) is a special bunch."
The crowd of 25,727 pushed the season attendance at PNC Park to more than 1 million.