SAN DIEGO (AP) -- With the San Francisco Giants getting hot, the Arizona Diamondbacks know they have to keep winning.
Joe Saunders took a five-hitter into the ninth inning, Paul Goldschmidt drove in three runs and the Diamondbacks beat the San Diego Padres 5-1 Sunday to cut the magic number to five for their first NL West title since 2007.
Arizona maintained a five-game lead over second-place San Francisco with nine games remaining, stopping a three-game losing streak. The Diamondbacks open a nine-game homestand Monday against Pittsburgh, then host the Giants for a three-game series next weekend.
"When you go on a little stretch and you get a little antsy like that, you start to press a little bit," Saunders said. "You just need to relax. When you relax, things come easier to you. I think that's what happened. They didn't try to do to much and we just played our game."
San Francisco kept the pressure on the Diamondbacks with its eighth straight win, 12-5 at Colorado.
"It's been a couple of days, so it's a good feeling," Arizona manager Kirk Gibson said. "Every victory at this point of the season is great. The Giants have been playing great and are on a big winning streak. We needed to match that and take care of our own business."
Saunders (12-12) wanted to make sure he did his job at Petco Park, where he has pitched his best games this season.
The lefty limited last-place San Diego to an unearned run and seven hits in 8 2-3 innings, improving to 3-1 with a 1.47 ERA against the Padres this year. He threw his only complete game this season in a 6-1 win at San Diego on July 26.
"I came in this morning and decided I need to go out there and throw my `A' game," Saunders said. "We got some clutch hits down the stretch. We're grinding it out. It was a good win for us."
After Saunders allowed two-out singles by Kyle Blanks and Alberto Gonzalez in the ninth, J.J. Putz struck out pinch-hitter Nick Hundley for his 41st save in 45 chances.
Goldschmidt led the Arizona offense, which managed just three runs during the losing streak. Goldschmidt had three hits, including a leadoff homer in the sixth that put the Diamondbacks ahead for good at 2-1.
"We just couldn't get to Joe Saunders ," Padres manager Bud Black said. "His assortment of fastballs in, fastballs down and away. We just couldn't get enough balls squared against him."
Aaron Harang (13-7) allowed two runs and eight hits in six innings. He has lost four of his last five starts despite a 3.19 ERA in that span.
Cameron Maybin had a leadoff single in the third, stole second, took third on Miguel Montero 's throwing error from behind the plate and scored on Jason Bartlett 's groundout.
Montero's 17th homer tied the score leading off the fourth. Goldschmidt put the Diamondbacks ahead 2-1 with a leadoff homer in the sixth.
"It was just a first-pitch fastball up and away," Goldschmidt said. "He likes to get ahead with fastballs, so I was looking for it."
Goldschmidt combined with Aaron Hill for RBI singles in the seventh against Brad Brach and added a sacrifice fly against Erik Hamren in the eighth.
NOTES: Arizona was 11-7 against San Diego, which is 23-43 against the NL West. ... RHP Ian Kennedy (19-4, 2.99 ERA) will attempt to become the NL's first 20-game winner this season Monday when he faces Pittsburgh RHP Jeff Karstens (9-8, 3.45). ... San Diego LHP Corey Luebke (5-9, 3.27) will start the opener of a three-game series, the club's final road games, at Colorado against RHP Kevin Millwood (3-2, 3.68).