Updated

It had been a winning formula for the Pittsburgh Pirates all season — take the lead into the eighth inning and let set-up man Jason Grili and closer Joel Hanrahan finish off the victory.

However, that formula didn't work Tuesday night as Grilli failed to retire any of the four batters he faced in the eighth inning and gave up a three-run homer to Chris Johnson as the Arizona Diamondbacks rallied for a 10-4 victory.

The Pirates had been 53-0 when leading after seven innings.

"You never like it to happen but it happened," Pirates manager Clint Hurdle said. "We were 53-0 before today and now we are 53-1. We look at some tape, make some evaluations, see what wrong and move on."

Grilli was entrusted with 4-3 lead at the start of the eighth inning after the Pirates had scored twice in the seventh to go ahead.

Paul Goldschmidt ripped Grilli's first pitch to right field for a double, moved to third on Justin Upton's bloop single to center and scored the tying run on Miguel Montero's single to right.

Johnson then hit a drive deep to center field to put Arizona ahead 7-4. That chased Grilli, whose ERA to 2.66 from 1.77.

"It's just a night you don't want to have as a reliever," Grilli said. "We just took the lead and it wasn't the plan to give the lead right back. It doesn't feel good. It leaves a bad taste in your mouth. Still, you've just got to move on to tomorrow and try your best to forget about it."

Johnson added another home run in the ninth, a two-run shot off Chris Resop, after Montero hit an RBI double.

Johnson has five home runs and 15 RBIs in eight games since being acquired from Houston in a July 27 trade. He left the Astros, who have the worst record in baseball, for the Diamondbacks, who entered Tuesday four games behind the division-leading Los Angeles Dodgers in the NL West.

"It's a lot of fun to look at the scoreboard and see what this team is doing and what that team is doing," Johnson said. "Every game means something. Every at-bat means something."

Johnson had eight home runs and 41 RBIs in 92 games for Houston.

"I think he is comfortable in Arizona," Diamondbacks manager Kirk Gibson deadpanned.

Goldschmidt, who doubled twice, and Stephen Drew both had three of the Diamondbacks' 15 hits. Drew homered and drove in two runs.

Brad Ziegler (5-1), who faced one batter and induced Michael McKenry an inning-ending double play in the seventh inning, got the win and J.J. Putz worked the ninth in a non-save situation. Ziegler leads all major-league relievers by getting batters to ground into 13 double plays.

"The double play was the play of the game," Gibson said. "It gave us a chance to win."

Travis Snider had three hits for the Pirates and Andrew McCutchen, who leads the major leagues with a .372 batting average, had two hits and two RBIs. Rookie Starling Marte his hit third home run in 12 games since being recalled from Triple-A Indianapolis and making his major-league debut June 26.

Marte hit a leadoff home run in the seventh inning off Takashi Saito to draw the Pirates even at 3-3. The Pirates then pulled in front on Neil Walker's sacrifice fly.

Drew almost singlehandedly put Arizona ahead 3-2 by the fourth inning as he had hits in his first three at-bats.

He singled to lead off the game and scored on Goldschmidt's two-out single. Drew hit a solo home run, his second, in the third before breaking a 2-2 tie with an RBI single in the fourth.

McCutchen drove in the Pirates' first two runs with a sacrifice fly in the first inning and a single in the third that made it 2-2.

"Everything I threw to McCutchen, he hit," said Arizona rookie left-hander Patrick Corbin, who started and pitched six innings. "I can see why he's having such a great season."

Corbin gave up two runs and six hits in six innings while striking out seven and walking three. Pittsburgh's Jeff Karstens also went six innings and allowed three runs and eight hits with four strikeouts and no walks.

Notes: Pittsburgh RHP Juan Cruz, who has been on the DL since July 18 with right shoulder inflammation, is tentatively scheduled to make a second injury rehabilitation appearance Thursday with Double-A Altoona. Cruz retired one of the five batters he faced Monday night while pitching for Altoona against Bowie in the Eastern League. ... Pirates RHP Kevin Correia (8-6, 4.49), who was removed from the starting rotation two weeks ago when LHP Wandy Rodriguez was acquired from Houston in a trade despite winning five straight starts, will make a spot start Wednesday night against Diamondbacks RHP Ian Kennedy (10-8, 4.15). ... Hurdle has decided to give his starters an extra day of rest with his club in a stretch of playing 20 games in as many days. . Arizona backup C Henry Blanco is scheduled to undergo surgery Wednesday to repair a torn ligament in his left thumb. Blanco was injured Sunday at Philadelphia when the Phillies' John Mayberry Jr. slid into his mitt on a play at home plate. .... NASCAR driver Kurt Busch threw out the ceremonial first pitch.