PHOENIX — Three straight homers off Washington Nationals ace Max Scherzer in the first inning had the Arizona Diamondbacks set up for an easy victory over the NL East leaders.

Instead, they needed Brandon Drury's bases-loaded single in the bottom of the ninth for a 6-5 victory Friday night.

The home runs by David Peralta, A.J. Pollock and Jake Lamb to start their first at-bat helped stake the Diamondbacks to a 5-0 lead against Scherzer.

"We did a great job getting his pitch count up and also putting runs on him," the Diamondbacks' A.J. Pollock said. "Great getting on him early. We would've loved to have (scrapped) a couple of runs in the middle of the game, but the key point is we won the game and we came through in the end."

The first-inning feat was the first in the majors since Baltimore did it against Texas on May 10, 2012. It was the first time in Nationals history (2005 to present) that an opposing team has hit back-to-back-to-back home runs.

The Diamondbacks last hit three straight homers on Aug. 11, 2010, when they had four in a row at Milwaukee.

It was the most runs allowed by Scherzer in a first inning since July 2, 2011, against San Francisco, when he gave up five.

"I had four pitches today. I was using them. They beat me," Scherzer said. "I just couldn't get the ball exactly where I wanted it. When you do that against this type of ballclub and these types of hitters, they are really good and they make you pay."

Scherzer's five runs allowed tied for the most he's given up in a start this season, and the five innings tied for his shortest outing of the season.

Arizona sent nine batters to the plate in the four-run first and the Diamondbacks made it 5-0 in the second on Lamb's RBI double.

Scherzer had allowed just one home run in 34 2/3 innings over five starts before he surrendered the three home runs on his first 10 pitches. The All-Star right-hander and two-time Cy Young Award winner was tagged for three homers in a game for the first time since May 6, 2016, against the Chicago Cubs, when he allowed four.

"I don't think I have ever seen a game starting off with three homers. Max hadn't seen it, either," Nationals manager Dusty Baker said.

Peralta, Pollock and Lamb also each had a double, another historical first for the Diamondbacks.

"Let's go get a cheeseburger," Diamondbacks manager Torey Lovullo deadpanned when asked what he could say to his players about the importance of the win. "We've got to regroup and come back and do it all over again tomorrow."

The Nationals rallied with Daniel Murphy's run-scoring double in the fourth, then added two more runs in the fifth off Diamondbacks starter Zack Godley. A leadoff double for Matt Wieters led to Brian Goodwin's RBI groundout, and Ryan Raburn singled in Wilmer Difo with two outs.

Godley struck out a career high 10 in 5 2/3 innings, and allowed four runs and five hits.

Difo drove in two runs, one to cut the lead to 5-4 in the sixth and the other that tied the game on a groundout to first in the eighth.

The Diamondbacks loaded the bases in the ninth on Pollock's triple and intentional walks to Lamb and Paul Goldschmidt by Enny Romero (2-4). After Gregor Blanco flied out to shallow left, Drury bounced a single into right field for Arizona's third win in four games.

Drury has four career walk-off hits in just his second full season in the majors.

"Any time you help the team win a ballgame, especially a big game like that against the Nationals at the beginning of a homestand, it's huge," Drury said. "It was a good win for sure. That was unbelievable in the first inning against Scherzer."

Closer Fernando Rodney (4-3) pitched an inning for the win.

KETEL'S KEY PLAY

The Diamondbacks sent the game to the bottom of the ninth still tied at 5 when shortstop Ketel Marte made a big play on a sharply hit grounder from Nationals star Bryce Harper. Marte went to his right into the hole and snagged the bouncer, then got off a strong throw to first base to retire Harper and end the top of the ninth.

TRAINER'S ROOM

Diamondbacks: OF J.D. Martinez (bruised hand) was available but didn't play Friday, and should soon return to everyday action. ... OF Rey Fuentes (left thumb bruise) will be shut down to allow the injury to calm down before resuming baseball activity. ... OF Yasmany Tomas (groin) is hitting and throwing but feeling some minor pain. . RHP Rubby De La Rosa (right shoulder) was set to throw in a rehab game Friday night for Reno.

Nationals: OF Michael A. Taylor (oblique) is still not ready to start baseball activities, Baker said. He's been on the disabled list for two weeks.

UP NEXT

Nationals: RHP Tanner Roark (7-6, 4.98 ERA) got the win in his most recent start, July 16 at Cincinnati. He allowed three runs and four hits in six innings.

Diamondbacks: Anthony Banda is expected to be called up from the minors in time to start against the Nationals. He would be making his major league debut.