PHOENIX -- Innings don't end with two outs. Sometimes they're just getting started.
Arizona had two outs and none on in a tie game in the fifth inning. A walk and error later, Conor Jackson hit a three-run homer and the Diamondbacks went on to beat the Pittsburgh Pirates 7-3 on Tuesday night.
Johnny Estrada also homered in the Diamondbacks' seventh victory in nine games.
"We're good with two outs, I'll tell you what," Jackson said. "It's something we kind of pride ourselves in."
Jason Bay hit two solo homers, giving him six in the last six games, but the Pirates still lost their third in a row and fifth of six.
"One guy's not enough to carry a team a lot of times," Bay said. "I've been doing a lot better lately, but we're still not winning."
Estrada, who leads the Diamondbacks with 31 RBI, tied the game with a two-run homer off Victor Santos in the fourth, then Jackson's three-run shot off Santos in the fifth put the Diamondbacks ahead 5-2.
"For a team that doesn't hit too many homers, we had two big homers tonight," Arizona manager Bob Melvin said, "two very big homers."
The NL West-leading Diamondbacks climbed seven games above .500 (26-19) for the first time this season and improved to 6-2 on its homestand with one game to play.
Claudio Vargas (5-2) gave up two runs in the first, then blanked the Pirates for the next five innings. Vargas, claimed off waivers from Washington last season, allowed five hits, striking out five and walking two.
Bay's homer leading off the eighth, his 12th of the season, was a 418-foot opposite-field homer to right off reliever Brandon Lyon.
Pirates manager Jim Tracy said his team virtually gave the Diamondbacks the game.
"The Estrada home run, you can live with that," he said, "but the other five you give them, that means you have to score eight to win. You can't put yourself in that kind of position."
Santos (1-5) allowed five runs, two earned, and six hits in six innings. He struck out five and walked two.
Nate McLouth led off the game with a double, then took third on Jack Wilson's sacrifice bunt. McLouth scored when Freddy Sanchez grounded out, then Bay's homer to left made it 2-0.
Arizona tied it in the fourth when Santos walked Jackson leading off, then Estrada hit a 3-2 pitch into the seats in right for his fourth homer.
Santos got two quick outs in the fifth, then walked Chad Tracy in a nine-pitch at-bat with Tracy fouling off three pitches before taking ball four. First baseman Ryan Doumit, playing despite a sore hamstring, couldn't handle Luis Gonzalez's sharp grounder for an error, then Jackson hit a 2-0 pitch nearly 400 feet into the left field stands.
"Two outs, nobody on, a two-out walk, an error and then a bad two-ball, no-strike pitch and Conor Jackson hits it out of the park," Jim Tracy said. "But the reality of the situation is he shouldn't have come up."
Arizona added two runs in the eighth.
With runners at first and second, Craig Counsell hit a slow chopper to Wilson at shortstop and beat the throw. The ball got past Doumit but second basemen Jose Castillo was backing up on the play. Estrada, who had been on second, tried to score. Castillo's throw was off line, but catcher Ronny Paulino caught it and made the tag, only to have the ball fall out of his glove.
The second run scored on Matt Capps' wild pitch.
Pirates 1B Sean Casey, sidelined with a back injury, took batting practice, ran the bases and fielded grounders before the game. Tracy says Casey is close to being sent to the minors on a rehab assignment. ... Gonzalez was adamant that his grounder in the fifth should have been ruled a hit, not an error. ... Castillo made a diving stop to his right to rob Orlando Hudson of a hit in the fourth. ... Arizona clinched its sixth consecutive home series win. ... The Diamondbacks extended their streak of turning at least one double play to 15 games.