Jayson Werth cracked a two-run shot, while Anthony Rendon, Ian Desmond and Bryce Harper clubbed solo blasts for the Nationals, who snapped a three-game losing streak.
Rendon finished 4-for-4 with two runs scored and Harper posted three hits.
Jordan Zimmermann (10-5) struck out eight and surrendered two runs on seven hits and a walk over six frames to notch the win.
Felix Hernandez (13-5) served up a career-high four homers, allowing five runs on 10 hits and a walk over seven innings for Seattle, which has dropped three of its last four contests.
The Mariners led 2-1 following an inning of play, but Washington plated two runs in the third, fourth and eighth innings to surge ahead.
Rendon worked a two-out walk in the third before Werth golfed a slider into the patrons in left-center.
In the fourth, Desmond led off the frame by whacking a belt-high fastball over the wall in left. Ramos circled the bases two batters later with a no-doubt shot to left.
Harper went yard to right-center for his 50th career homer with two outs in the eighth and Ramos followed with his second blast of the night to give the Nats a 7-2 advantage.
Adam LaRoche added a sacrifice fly in the top of the ninth, while Endy Chavez's RBI double in the bottom half capped the scoring.
Earlier, Rendon's one-out homer opened the scoring for Washington, but RBI singles by Kendrys Morales and Kyle Seager in the home first gave Seattle its 2-1 edge.