PHOENIX -- Two hours into his return to the major leagues, Arizona pinch-hitter Andy Marte displayed the stroke that made him one of the top prospects in the game a decade ago.

Marte, purchased from Triple-A Reno after Martin Prado was traded Thursday afternoon, hit a tie-breaking, two-run home in the sixth inning to help the Diamondbacks to a 7-4 victory over the Pittsburgh Pirates at Chase Field. He arrived at the park about 20 minutes after the game started.

"They told me to be ready, I might pinch-hit, so I went to the cage and started getting loose," Marte said.

Marte's two-run homer off left-hander Jeff Locke (2-3) gave Arizona a 5-3 lead, and Aaron Hill hit a solo homer to cap the three-run inning. It was Marte's first major league at-bat since Oct. 3, 2010, while with Cleveland, and his first homer since Sept. 8, 2010.

"It feels great to be back," said Marte, who spent parts of six seasons in the majors with Atlanta and Cleveland. "I went to Triple-A and worked hard, tried to prove I can still play here. That's what I'm trying to."

Arizona manager Kirk Gibson saw Marte in the dugout when he arrived in the second inning.

"I said 'Good to see you. Get ready to win a game,'" Gibson said.

Shortstop Nick Ahmed led off the sixth inning with a single before Marte hit the second pitch he saw, a changeup. Marte, 30, was leading the Pacific Coast League with a .330 batting average.

"When I went back out for the sixth inning I just felt fatigued and just tried to make pitches," Locke said.

"Fighting myself a little bit, leaving the ball elevated and elevating changeups. That is something I am not accustomed to doing very often. When that ball starts getting up even I start asking questions."

Third baseman Jordan Pacheco had two hits and an RBI in his first start for Arizona (48-61), which won for the third time in four games.

Second baseman Neil Walker had two hits, including his 16th homer, and catcher Russell Martin had a two-run double for the Pirates (57-51), who lost for the second time in five games.

Right fielder Gregory Polanco had two hits for Pittsburgh.

Ahmed had two hits, including his first major league home in the eighth inning.

Arizona left-hander Oliver Perez (2-1) got the final two outs in the sixth inning for the victory, and closer Addison Reed pitched the ninth inning for 27th save.

"We had a couple of chances early but never busted it," Pittsburgh manager Clint Hurdle said.

Walker singled to left field to open the second inning and went to second base when first baseman Ike Davis walked before Martin doubled off the base of the fence in left-center field for a 2-0 lead.

Arizona tied it with two unearned runs in the fourth inning. Left fielder Mark Trumbo had an infield single and Pacheco doubled into the left field corner to put runners on second and third.

After right fielder David Peralta was hit by a pitch and popped out, Davis failed to handle a throw from third baseman Pedro Alvarez on a grounder by Arizona starter Josh Collmenter that should have ended the inning. Two runs scored.

"That is a ball that is catchable," Hurdle said. "He has caught that one before. He didn't catch that one today. Nobody felt worse about it then he did."

Pacheco singled in first baseman Paul Goldschmidt to make it 3-2 in the fifth inning.

Walker's solo homer off Collmenter with one out in the sixth inning tied it at 3.

NOTES: 3B Andy Marte, a non-roster invitee to spring training this year, spent most of 2013 in an independent league after sitting out 2012. He had 13 home runs and 62 RBIs at Reno. ... Arizona ecalled OF Roger Kieschnick from Triple-A Reno to fill the roster spot left RF Gerardo Parra was traded to the Milwaukee Brewers. The D-backs received three minor leagues in the two deals -- C Peter O'Brien from the Yankees and OF Mitch Haniger and LHP Anthony Banda from Milwaukee. O'Brien has 33 homers, third behind Texas prospect 3B Joey Gallo (37) and Cubs prospect 3B Kris Bryant (34). .. Since June 1, Pittsburgh (32-21) has the best record in the National League. ... The game featured a match of 1-2 finishers in the 2013 NL MVP race, Pirates CF Andrew McCutchen and Arizona 1B Paul Goldschmidt. McCutchen received 30 of the 32 first-place votes.