PHOENIX -- Wilson Ramos is having his most productive year, and he has been particularly effective with runners in scoring position. The Nationals Washington catcher was at it again Tuesday. Ramos hit a tiebreaking, three-run homer in the fifth inning to spark the Nationals to a 10-4 victory over the Arizona Diamondbacks at Chase Field. It was his 16th homer, tying a career high set in 2013. "I worked a lot to try to stay patient and focused at the plate, especially with runners in scoring position," Ramos said through a translator. "I've been concentrating on trying to hit the ball up the middle, and it's been working out very well. I want to help the team every way possible." With the game tied at 2, Ramos hit a 2-2 slider into the left field seats after Daniel Murphy singled and Anthony Rendon walked with two outs off left-hander Robbie Ray (5-11). "He had struck me out on the same pitch in the previous at-bat, a slider in the dirt, so I was looking for that particular pitch," Ramos said. "He left it a little bit over the plate, and I took advantage of it." Ramos is hitting .331 this season, .351 with runners in scoring position. Chris Heisey and Jayson Werth added solo home runs, and six players had at least two hits for the Nationals (63-44). Washington recorded its fifth win in seven games. Right-hander Tanner Roark (11-6) gave up three runs and seven hits in 6 1/3 innings while winning for the fifth time in his past six decisions. He struck out six and walked two. Heisey's homer, his sixth, followed Ramos' for a 6-2 lead. Jake Lamb's solo homer in the last of the sixth inning brought Arizona within 6-3 before Werth led off the seventh inning with his 13th homer. The ball bounced off the top of the left field fence and into the Arizona bullpen. Lamb had two hits and two RBIs, Paul Goldschmidt collected three hits, Yasmany Tomas had two hits and a homer, and Chris Owings added two hits for Arizona. The Diamondbacks (43-64) lost their third in a row and fell for the 16th time in 21 games. They are 17-37 at home. Werth and Wilmer Difo had three hits and an RBI, Ramos had two hits and three RBIs, and Murphy contributed two hits and two RBIs. "It was a big night for him, a big night for us," Washington manager Dusty Baker said of Difo. Difo was a late entry into the starting lineup, playing second base when Bryce Harper was a late scratch because of illness. Trea Turner moved from second base to center and Difo started at second after playing mostly shortstop in the minors leagues this year. Turner, Murphy and Rendon had RBI singles in the Nationals' three-run eighth inning. The Nationals have 24 runs and 34 hits in winning the first two games of the series. The Diamondbacks have given up 38 runs in their past three games. Ray gave up six runs (five earned) and eight hits in six innings while losing for the sixth time in seven decisions. He struck out nine and walked two. Opponents are hitting .351 against him the third time through the order. "I went back and looked at it, it was a good pitch to Ramos," Ray said. "It was down. I don't even think it was a strike. He kind of reached out and flipped it. I made the pitch I wanted to make. If it was an inch lower, he probably swings over the top of it. It is just the way it is." NOTES: Nationals RF Bryce Harper was a late scratch from the starting lineup because of illness. The 2015 NL MVP, Harper is 7-for-59 (.119) since July 10. He is hitting .235. ... Washington 1B Ryan Zimmerman (wrist) was held out of the lineup for the second straight game after being hit by a pitch in the ninth inning Sunday. ... Arizona RHP Rubby De La Rosa (elbow) threw 40 pitches in a simulated game/batting practice session Tuesday morning, his first time facing hitters since being shut down in late May. ... Arizona CF A.J. Pollock could begin a rehab assignment on Friday in the rookie-level Arizona League. Pollock hasn't played since fracturing his right elbow three days before the start of the regular season. ... The retractable roof at Chase Field was closed because of rain in downtown Phoenix. It was 74 degrees outside and 79 degrees inside.