Washington improved baseball's best record by moving 29 games over .500 with 43 games remaining in the regular season.
The Nationals have not had a winning record since moving to Washington from Montreal in 2005 and they need only eight more victories to achieve that feat this year.
New York took a 2-0 lead in the first on a two-run single by Daniel Murphy, but Washington struck in a big way in the fourth to go in front for good.
Harper added a two-run shot in the fifth to give the Nationals a 6-2 cushion.
The win went to Ross Detwiler (7-5), who gave up three runs on six hits in six innings. Tyler Clippard put two runners on in the ninth before escaping with his 26th save.
Santana (6-9) allowed all six Washington runs on seven hits in five frames.