PITTSBURGH -- Chris Johnson is enjoying his first pennant race.
"It's a lot of fun to look at the scoreboard and see what this team is doing and what that team is doing," the Arizona Diamondbacks third baseman said. "Every game means something. Every at-bat means something."
Johnson has seemingly made every at-bat count in his first eight games since being acquired from Houston in a July 27 trade.
He homered in the eighth and ninth innings Tuesday night, giving him five in eight games since the trade, to rally Arizona to a 10-4 victory over the Pittsburgh Pirates.
Arizona entered the game in third place in the NL West, four games behind the division-leading Los Angeles Dodgers. Johnson has given the Diamondbacks a big lift in their attempt to defend their NL West title as he has driven in 15 runs.
Johnson had eight home runs and 41 RBIs in 92 games for Houston, which has the worst record in the major leagues.
"I think he is comfortable in Arizona," Diamondbacks manager Kirk Gibson deadpanned.
Johnson's homer in the eighth carried far over the fence in center field and capped a four-run rally against Jason Grilli (1-4) that put Arizona ahead 7-4. Pittsburgh had just taken a 4-3 lead with two runs in the seventh.
Miguel Montero doubled in a run in the ninth before Johnson hit a two-run homer off Chris Resop to seal the victory for Arizona, which had lost three straight.
"I felt like I could come in here and help out," Johnson said. "I have confidence in what I can do as a player. I was on a pretty good streak with Houston before the trade. I'm probably not going to keep producing like I have been for the last week or so but I do think I can help us win."
The Pirates lost for the third time in four games and had been 53-0 when leading after seven innings.
Paul 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.
Grilli failed to retire any of the four batters he faced after being called on to hold a 4-3 lead that the Pirates took by scoring twice in the seventh inning. His ERA jumped 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."
Goldschmidt lined a double to right field on the first pitch of the eighth inning, took third on Justin Upton's bloop single to center and scored the tying run on Montero's single to right.
Johnson then hit a 1-0 pitch to put Arizona ahead 7-4.
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 single-handedly 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.
Drew came into the game hitting just .202 in 29 games since missing nearly the first three months of the season recovering from last season's broken ankle.
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.
Both starters pitched six innings. Arizona rookie Patrick Corbin gave up two runs and six hits in six innings while striking out seven and walking three. Pittsburgh's Jeff Karstens allowed three runs and eight hits in six innings with four strikeouts and no walks.
Notes: 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. ... 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). ... Pittsburgh manager Clint 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. ... NASCAR driver Kurt Busch threw out the ceremonial first pitch.