The Nationals trailed 5-1 entering their final at-bat but scored five times -- all with two outs -- stunning the Mariners and posting a dramatic win in the first contest of a three-game set.
After Danny Espinoza provided an RBI single to make it 5-3, Ramos connected for his game-winning homer.
The rally made a winner of Todd Coffey (3-0), who hurled a scoreless top of the ninth.
Seattle starter Doug Fister drove in a run and held the Nats to one run on three hits in an eight-inning performance.
Adam Kennedy went 3-for-5 with a pair of run-scoring singles and Dustin Ackley contributed two RBI for the Mariners.