PHOENIX -- The San Diego Padres coughed up a big lead late, costing Pedro Avila a victory in his major league debut.
That they managed to win anyway is a testament to how this surprising season has gone so far.
"You give up a five-run lead and Margot gets a big hit, just another guy coming off the bench doing huge things for us," manager Andy Green said. "That's just a great win."
Avila was impressive in his debut, scratching through a shaky first inning to allow a run and four hits while striking out five in 5 1/3 innings.
But the bullpen couldn't hold the lead.
Arizona loaded the bases against Robert Stock in the seventh, scoring two runs on David Peralta's single. Brad Wieck entered and Eduardo Escobar hit a three-run homer off the top of the left field wall to tie it 6-all.
Archie Bradley (0-1) struck out the first two batters in the eighth before Margot hit his first homer of the season out to left.
"It was one pitch that got away," Bradley said. "That is the role we're in on the back end there. You just can't let that happen."
Green didn't want to dig deep into his bullpen, but was forced to after Avila came out.
Craig Stammen (1-0) allowed a hit before closing out the seventh inning and Trey Wingenter, giving Kirby Yates a rest, walked two in the ninth before striking out Nick Ahmed for his first career save.
The Padres have won six of eight to move into first place in the NL West.
The Diamondbacks went 3 for 11 with runners in scoring position and let a chance to win slip away on one pitch out over the plate.
"I thought the way we fought back and knocked down five runs was a perfect remedy for us to win the ballgame," manager Torey Lovullo said. "Unfortunately, we didn't have that shutdown inning."
The Padres optioned left-hander Robbie Erlin to Class A Lake Elsinore, clearing room for Avila to become the third San Diego pitcher to make his big league debut in the season's first 14 games. Nick Margevicius and Chris Paddack each debuted against San Francisco.
Avila had never made an appearance above Class A before this season and made one start at Double-A Amarillo before being called up. The 22-year-old right-hander got off to a rocky start, giving up three hits and a walk in the opening inning. He escaped by allowing just one run, on Adam Jones' single, and retired the next 12 batters he faced.
Avila was lifted after hitting a batter with a pitch and walking another in the sixth.
"At the beginning I was feeling a little bit anxious, little shaken out there," Avila said through a translator. "In the end, it was a fantastic experience."
Godley gave up six runs on six hits and struck out eight in six innings.
Arizona's pitching staff has at least 10 strikeouts in four consecutive games. ... Each of the past four Padres starters making his major league debut -- including Jacob Nix last season -- has pitched at least five innings and allowed a run or less. ... Peralta was 2 for 5 and has 22 hits, a team record through 13 games. The previous mark of 21 was set by Orlando Hudson in 2007. ... Reyes has three homers in eight at-bats against Godley and is 4 for 26 against all other Arizona pitchers.
Diamondbacks: RHP Taijuan Walker will throw a bullpen Friday in his rehabilitation from Tommy John surgery.
Padres: Paddack (0-0, 1.04 ERA) has 11 strikeouts through two big league starts after splitting last season between Class A and Double-A.
Diamondbacks: RHP Luke Weaver (0-0, 6.75) will make his third start for Arizona since arriving from St. Louis as part of the Paul Goldschmidt trade. Weaver bounced back from a shaky Diamondbacks debut by allowing three runs in five innings of a 5-4 win over Boston.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
The Undefeated Roundtable: Lonnae O'Neal, Martenzie Johnson and Jerry Bembry discuss Ice Cube's comment on diversity in baseball
Does the rapper, actor and BIG3 founder have a point?
The Undefeated Roundtable: LeBron James and China, Ice Cube on diversity in baseball, Michael Rapaport and black culture
Also: Should the XFL be an option for Colin Kaepernick?
Babe Ruth's bat used for 500th home run to hit auction block
The bat used by Babe Ruth to slug his 500th career home run in 1929 is going up for auction, nearly 75 years after he gave it to a friend whose family has kept it ever since.
Scott Brosius replaces Joe Girardi as manager of USA Baseball
Scott Brosius has replaced Joe Girardi as manager of the U.S. baseball team. Girardi quit before managing a single game prior to Olympic qualification so he can seek MLB employment.
Yankees, Astros give Game 4 another try after rainout
During the regular season, the New York Yankees never used their high-leverage relievers three days in a row.
Kurkjian: Game 4 postponement benefits the Astros
Tim Kurkjian sees the delay of Game 4 of the ALCS benefiting the Astros in the long run because of the pitching matchups going forward.