SAN DIEGO — Travis Wood came up with an outing nothing like his recent ones and he led the San Diego Padres to a 6-2 victory over the Arizona Diamondbacks on Tuesday night.

"Better location and keeping the ball down," Wood said.

Wood was nearly out of the rotation after two bad outings. In his last two starts, he allowed 16 runs (15 earned), 16 hits and two walks over 4 1/3 innings.

So when Arizona's A.J. Pollock led off the game with the first of his two homers, most thought Wood hadn't changed much.

"But I felt really good," Wood said. "So I just locked it back in and got ready to attack."

He pitched six efficient innings and contributed two RBIs as Arizona failed to gain ground in the NL wild-card race despite Pollock's two homers and a double. The loss reduced the Dodgers' magic number to clinch the NL West to two.

Wood (4-6), who surrendered a career-high nine runs in his last start, rebounded to win for the first time since Aug. 19. The southpaw was the benefactor of three double plays as he allowed two runs, three hits and two walks. He struck out three in raising his record at Petco Park this year to 4-1 in five starts.

"It's not letting them elevate balls by elevating them myself," Wood said. "That is something we focused on the last couple of weeks and I was able to put it together tonight."

San Diego scored five times in the first three innings as it beat the Diamondbacks for the second straight game to clinch the series. Arizona has still won 20 of its last 28 games since Aug. 21.

Three Padres relievers blanked the Diamondbacks over the final three innings. Brad Hand got the final three outs for his 20th save.

Zack Godley (8-8) got knocked around early but lasted until the fifth inning. He was charged with five runs and eight hits. He walked three, with six strikeouts. Godley had won three of his last four starts.

"I just thought we never got into a rhythm on the mound," Arizona manager Torey Lovullo said. "I know Zach was grinding away at things."

Carlos Asuaje's RBI single in the sixth pushed the Padres back in front 6-2.

Pollock produced his second career multi-homer game with another long fly in the sixth, his 12th on the year. He redirected Wood's 78 mph curveball into the left field seat's second deck, pulling the Diamondbacks within 5-2.

"You go through stretches where you feel good and good stuff happens, and then you feel good and good stuff doesn't happen," Pollock said. "And then the opposite when it doesn't go your way. But I would have loved to get the win there, obviously that's No. 1."

San Diego scored three times in the third for a 5-1 lead. The big blow was Wood smacking a two-run, two-out single to center on a full-count pitch. That followed Yangervis Solarte's run-scoring single, his second RBI of the game.

The Padres went ahead 2-1 in the first on Wil Myers' RBI single off the left-field wall and Solarte's sacrifice fly. In the inning's top half, Pollock led off with a homer.

Myers lingered in the box when watching his line drive, which didn't go over well with manager Andy Green.

"He should have had two doubles tonight," Green said. "With his speed, when you hit the ball off the wall it's a double."

TRAINER'S ROOM

Diamondbacks: OF David Peralta (tight right quad) was out of the lineup but available to pinch-hit. ... C Chris Owings (fracture right middle finger) is making progress and could join the team for its final regular-season series against the Royals.

Padres: OF Jose Pirela (bruised left pinkie) was scheduled to take batting practice on Tuesday and then be re-evaluated. It's possible Pirela will be shut down for the remainder of the season.

UP NEXT

Diamondbacks: LHP Robbie Ray (14-5, 2.74 ERA) is 5-0 with a 1.39 ERA since returning from the disabled list on Aug. 14 after being struck in the head by a line drive. Ray has defeated the Padres in all three of his starts against them this season. Ray has had 10-plus strikeouts in four straight starts.

Padres: RHP Dinelson Lamet (7-7) has decreased his ERA in four straight starts but he hasn't won since Aug 15. The Padres have scored four runs in his five starts since then.