PHOENIX -- Arizona manager A.J. Hinch is looking forward to checking out the NL West standings in the morning.
The Diamondbacks ended their one-month stay in the cellar with a 6-2 victory over the San Diego Padres on Wednesday, wrapping up a three-game sweep.
Felipe Lopez hit a three-run homer to cap a five-run rally in the eighth and Max Scherzer pitched seven sharp innings as the Diamondbacks won their season-high fifth straight game and vaulted the Padres into fourth place.
"Looking at the standings every day, to not be in last place is big and a breath of fresh air," Hinch said. "Not to get too far ahead of ourselves, but to wake up tomorrow and be out of that is a nice feeling."
Arizona's winning streak is its longest since an eight-game streak in April 2008. But the Diamondbacks remain buried in the division and wild card races.
"We want to be the first-place team," Scherzer said. "So, really, not being last, it doesn't mean too much."
Will Venable and Kevin Kouzmanoff each had RBI doubles for San Diego, which took over last place with its seventh loss in eight games.
Through seven innings, San Diego appeared on its way to salvaging the final game of the series. But the Diamondbacks stormed ahead in the eighth.
With Arizona down 2-1, Miguel Montero blooped a one-out single down the left-field line against Gary Burke (1-1), then took third on Gerardo Parra's single.
After San Diego manager Bud Black called on Mike Adams, Chad Tracy hit a smash to first baseman Adrian Gonzalez, who bobbled the ball. Gonzalez was charged with an error and Tracy credited with a tying RBI.
"We had a potential double-play ball that didn't happen," Black said.
One out later, Romero fouled off several pitches before singling to right field to score Parra with the go-ahead run.
"It wasn't scalded, but it was in the right place," Black said.
Lopez followed with a three-run shot to right field, his fifth, to clinch the victory for Clay Zavada (2-2), who pitched a scoreless eighth.
San Diego brought the tying run to the plate against Arizona closer Chad Qualls, who entered with a four-run lead. But Qualls struck out pinch-hitter Eliezer Alfonzo and got pinch-hitter Edgar Gonzalez on a flyball to leave the bases loaded and preserve the victory.
Scherzer went seven innings, allowing two runs on four hits. He walked three and struck out nine.
After losing his last two starts, Scherzer regained the command that he had displayed during a personal three-game win streak last month.
"I'm getting a lot better feel for my changeup," Scherzer said. "I really didn't even have to throw too many sliders today. I was able to go fastball-changeup and keep them off-balance."
Scherzer struck out four of the first five men he faced. But the Padres caught up with the fastballer in the fourth, scoring on doubles by Kouzmanoff and Venable to take a 2-0 lead.
The Diamondbacks cut the lead in half in the seventh on Chris Young's sacrifice fly to center.
Gaudin pitched 6 2/3 innings, allowing one run on three hits. He walked four and struck out seven.
Gaudin left with two on and two outs in the seventh. Burke worked out of that jam, but the Padres' bullpen collapsed an inning later.
"It's just unfortunate that we couldn't hold onto it," Gaudin said. "Our bullpen's been good for us, but that's going to happen from time to time."
Copyright 2015 Associated Press. All rights reserved. This material may not be published, broadcast, rewritten, or redistributed.