WASHINGTON — CJ Abrams and James Wood each homered twice and drove in three runs as the Washington Nationals outslugged the Arizona Diamondbacks, 10-7, on Sunday at Nationals Park to take two of three games in the weekend series.

Wood’s two-run shot in the fifth inning tied the score at 4-4, and three batters later Abrams put Washington ahead for good with a two-run home run off Jonathan Loaisiga (2-3). Dylan Crews and Abrams each finished with three of the Nationals’ 15 hits on the day.

Abrams’ pair of homers pushed his season total to 27, breaking Ian Desmond’s franchise record for shortstops (25, set in 2012), and his three RBI gave him a major league-leading 82 on the year. Wood’s two blasts gave him a team-high 30 home runs, making him just the second Nationals player — joining Adam Dunn — to post back-to-back 30-homer seasons. Riley Cornelio (2-1) picked up the win in relief, allowing one run over two innings, and Clayton Beeter recorded the final three outs for his 10th save.

The surprising Nationals improved to 54-52, pulling within a game of Arizona for the final National League wild-card spot. Washington opens a series against the Toronto Blue Jays on Monday, with left-hander Andrew Alvarez (2-3, 4.22 ERA) on the mound.