WASHINGTON -- It has been a rough week for several All-Star players in the nation's capital.

On Sunday Washington Nationals outfielder Bryce Harper hurt his thumb in Pittsburgh and has not played since. Catcher Wilson Ramos tore his ACL on Monday and is done for the season, while Washington general manager Mike Rizzo said earlier this week pitcher Stephen Strasburg likely won't appear in the National League Division Series.

With that as a backdrop, a patchwork lineup made up of young players and some veterans trying to prove themselves for a postseason roster spot led the East division champion Nationals to a 5-3 win on Thursday afternoon against the Arizona Diamondbacks.

That trimmed Washington's magic number to two to clinch the homefield edge over the Los Angeles Dodgers for the NLDS that begins October 7.

Wilmer Difo hit the first homer of his career, Pedro Severino clubbed his second and Michael A. Taylor had three hits and two RBIs for the Nationals as a light rain fell during the game.

"Very, very excited. My first career home run," said Difo via translator Octavio Martinez. "My main goal was to have the right mindset. I am not an everyday player."

Washington (93-66), which clinched the National League East title Saturday, is 48-30 at home while last-place Arizona (66-93) ended the year 36-45 in road games as the teams split the four-game series.

If the game had been rained out there was a chance Arizona would have had to come back Monday and play a makeup game if it had a bearing on the homefield edge.

"We just feel fortunate we got the game in," said Dusty Baker, the Washington manager. "It was a blessing we got the game in."

Difo, who started at second, hit a solo homer to left in the fifth to give the Nationals a 5-1 lead. The homer came in his 66th at-bat over the past two seasons. He also made a fine play in the field to end the sixth as he threw out Socrates Brito.

"We have seen Difo. He hurt us in Phoenix," said Chip Hale, the Arizona manager. "It was a patchwork lineup. Dusty has them playing hard and they did a good job today."

Washington scored three runs in the fourth for a 4-1 advantage.

Danny Espinosa drove in the first run with a groundout with the bases loaded, and Taylor had a two-run single with two outs off Arizona starter Robbie Ray (8-15), who gave up five runs, five hits and four walks with three strikeouts in 4 2/3 innings.

Said Ray: "Coming out I felt really good and I just kind of lost it. It was frustrating. It's not typically how you want to end the year but I feel like for the most part I've made some pretty big strides."

"He looked like he was in command (early)," Hale said of Ray. "After that he wasn't the same. The velocity varied. I don't know if he was playing with his velocity; there could have been some fatigue there. I wanted him to finish strong. Overall it was a good season for him."

Taylor and Ray were teammates at Class A Potomac of the Carolina League in 2012 and 2013 in the Washington farm system.

The Nationals tied the game at 1-1 in the third as Severino, in his 14th game of the year, hit a solo homer down the left field line. He will see more action after the injury to Ramos.

"I feel sad because that happened," Severino said of Ramos. "We have to keep working. I have to be ready. I am ready to play."

Washington's Joe Ross was making his third start since going on the disabled list in early July with right shoulder inflammation. Ross went four innings and gave up three hits and one run with two walks and five strikeouts while throwing 90 pitches.

"Ninety pitches is too many for four innings," Ross said.

The right-hander lasted just three innings on Sept. 18 at Atlanta and went 2 2/3 innings on Saturday in Pittsburgh while throwing 63 pitches.

Winning pitcher Reynaldo Lopez (5-3), who came on with two outs in the fifth, gave up a two-run homer with one out in the ninth to Brito to make it 5-3. Mark Melancon got the last two outs for the save, his 45th overall this year and 15th with Washington.

"He has been working on some things," Baker said of Lopez. "He has picked up his tempo. It was a good game for us to win."

NOTES: Arizona 2B Jean Segura (cramp) left the game in the top of the seventh after he leaned back from a pitch from RHP Reynaldo Lopez. Segura had a single in the third to give him 201 hits this season. Peter O'Brien pinch-hit for Segura with a 1-1 count and struck out. ...Washington RF Bryce Harper (thumb), INF Daniel Murphy (buttocks) and C Wilson Ramos (torn ACL) were all out of the starting lineup. Harper (.244, 24 homers) has not played since Sunday and Murphy (.347, 25 homers) has not played since Sept. 20 when he pinch-hit against the Miami Marlins. The Nationals hope to have Harper and Murphy in time for the NLDS opener ... The Nationals begin a three-game series at home Friday against the Miami Marlins. RHP Andrew Cashner (5-11, 5.13) will start for the Marlins against Washington RHP A.J. Cole (1-2, 5.09). ... Diamondbacks RHP Braden Shipley (4-5, 5.26) will face San Diego RHP Edwin Jackson (5-6, 5.77) on Friday in Arizona. ... Arizona OF Yasmany Tomas (stiff neck) was a late scratch from the starting lineup and was replaced by OF Mitch Haniger.