SAN DIEGO (AP) -- Luis Perdomo went from on the ropes to the winner's circle for the San Diego Padres on Tuesday night.
Manuel Margot and Jabari Blash homered to back Perdomo's six innings of solid pitching as the Padres beat the San Francisco Giants 6-3.
Perdomo (7-8) settled in after his pitch count climbed as he wiggled from jams in the first two innings.
"You could see that he was on the edge," Padres manager Andy Green said.
In winning for the first time in his last four starts, Perdomo surrendered two runs (one earned) and eight hits. He struck out three and walked two in working at least six innings in his eighth straight start.
"He was too quick in the first inning and then in the second," Green said. "Then he slowed himself down and for the rest of the game he was mostly good."
The Padres prevailed for the eighth time in their last 11 meetings with the Giants. Margot's fourth-inning blast, the rookie's 13th of the season, gave the Padres their first lead of the game. Blash's bash to lead off the fourth set the stage for the four-run inning.
Three Padres relievers finished off the Giants with Brad Hand handling the ninth for his 13th save.
The Giants lost for the fourth time in five games.
Matt Moore's dreadful season continued. Moore (4-13) entered the game with the highest ERA (5.38) of any qualified NL starting pitcher. In 16 of his 27 outings this season, he has allowed at least four runs.
Despite some encouraging signs in his last three starts, it was a familiar script for Moore against the Padres. Moore was charged with five runs and eight hits, with a walk and a hit batter. He struck out two.
Blash crushed Moore's 80 mph changeup in the fourth to tie the score at 2. His solo shot went 412 feet.
The big blow was Margot's three-run shot, which came after Austin Hedges reached on a walk and Perdomo via a fielder's choice.
Both Blash and Margot also delivered defensive gems in the outfield. Jose Pirela did as well when he leaped above the left-field fence in the eighth to rob Pablo Sandoval of a homer.
The Padres pulled within 2-1 in the second on Cory Spangenberg's RBI infield single.
The Giants struck first in the second, thanks to the Padres' shoddy defense.
Joe Panik singled to start the inning and advanced when Nick Hundley reached on Spangenberg's fielding error at third. Moore's one-out attempt to sacrifice turned into a bunt single and when Spangenberg produced a throwing error as Panik scored. Denard Span followed with an RBI double, his second of three hits, as the Giants went ahead 2-0.
"Those things happen," Perdomo said through a translator. "You just have to move on and get back to what I needed to do. That was to attack the batters, to go after them."
Manager Bruce Bochy knew the Giants let a chance to break fast slip away.
"Those first couple of innings, that came back to haunt us there," he said. "We created those chances there and couldn't cash in."
Giants: C Buster Posey (sprained left thumb) was out of the lineup for the second straight game. It's doubtful that Posey will start on Wednesday.
Giants: LHP Ty Blach (8-10, 4.68) is 0-3 with an 8.82 ERA over his last three starts, with opponents hitting .338 (23 for 68) against him. He's faced the Padres three times in his career, going 0-1 with a 3.71 ERA.
Padres: LHP Travis Wood (3-4, 6.03) has thrown at least five innings in each of his six starts with the Padres since coming over in a trade with the Royals. In nine career outings (seven starts) at Petco Park, he's 4-1 with a 2.33 ERA.