PHOENIX -- For a while, it looked like Brandon McCarthy's excellent outing might go to waste.
Then came the seventh inning.
The D-backs scored five runs in the frame to beat the Padres, 5-2, on Friday night at Chase Field.
McCarthy (2-3) won his second straight start, as he allowed one run on five hits over seven innings. Over his last three starts, McCarthy has permitted just one run in 24 innings.
"Just really good command of what he was doing, pretty efficient," manager Kirk Gibson said of McCarthy. "He's got confidence. You can just tell when he gets guys on, he starts making good pitches and getting out of there."
The win snapped a two-game skid for the D-backs, while the Padres dropped their third straight.
The way San Diego starter Eric Stults was pitching in the first six innings, it looked like the D-backs might become the final team in Major League Baseball to be shut out this year.
The left-hander kept the D-backs off balance and off the scoreboard, allowing just one hit through the first five innings and three hits through six, as the Padres maintained a 1-0 lead.
"He had good stuff," D-backs outfielder A.J. Pollock said. "He was tricky."
In the seventh, slumping catcher Miguel Montero led off with a ground-rule double, and Martin Prado followed with a double of his own to tie the game at 1.
"Sometimes when a guy is throwing that well, just little things like that spark the team, so that was huge," Pollock said.
One out later, Cliff Pennington drew a walk and pinch-hitter Wil Nieves doubled to left to score Prado for the go-ahead run and move Pennington to third.
That spelled the end of the evening for Stults (4-4) but it did not stop Arizona's offensive onslaught.
Pollock singled home a run off reliever Dale Thayer, and Paul Goldschmidt capped the inning with a two-run double off Anthony Bass to give the D-backs a 5-1 lead.
"I was hoping he was throwing a fastball," Pollock said. "But my hands stayed back and I was able to at least put the bat on the ball and hit it pretty hard and get the run in."
Despite what it looked like, McCarthy actually did not feel on top of his game after the first inning.
"Just kind of one of those weird nights where you're almost from the second inning on, you're just kind of battling, just hoping guys hit it at people ,and fortunately they did that for me," McCarthy said. "It happens every once in a while, and you have to figure out ways to stay in and at least make pitches and hope that the eight guys behind you can do something."
McCarthy said he tried to focus on what he had working for him, rather than what was not.
"I try to throw as many strikes as I can, and whatever I have that day just let it go into each pitch and sometimes it works and sometimes the other team will punish you if you're not on your stuff," McCarthy said. "But more often than not, if you just have conviction and just keep trying to do it, luck will favor you a little bit."
Everth Cabrera led off the eighth with a home run off reliever David Hernandez to pull the Padres to within 5-2, but closer Heath Bell -- pitching for the first time since May 15 -- shut San Diego down in the ninth to earn his seventh save.
The D-backs remain tied with the Rockies for first place in the National League West, and a lot of that is a credit to their starting pitching, which has compiled a 2.42 ERA over the last 17 games.
"I think we're all kind of settling into what we can do," McCarthy said. "And all of us are good at managing games and we're kind of good at turning over the lineup a little bit and getting as deep as we can. And that's kind of our job, is to just soak up as many innings as we can, try to do them high quality, and eventually the offense catches and we're in a good place."
That was certainly the case Friday.
Steve Gilbert is a reporter for MLB.com. Read his blog, Inside the D-backs, and follow him on Twitter @SteveGilbertMLB. This story was not subject to the approval of Major League Baseball or its clubs.