Trailing 6-4 in the eighth, the Nationals erupted for four runs -- all unearned -- to grab control of the contest.
The floodgates were opened when Marlins reliever Mike Dunn (0-1) dropped a routine throw while covering first base on Adam LaRoche's infield grounder.
Jayson Werth walked and one out later Steve Lombardozzi plated LaRoche with a single, cutting the Nats' deficit to one run.
Pinch-hitter Tyler Moore came up and delivered a game-tying single and Espinoza then followed with his decisive three-run blast into the left-field bullpen.
Bryce Harper made it back-to-back homers with a solo shot to cap the big rally for National League East-leading Washington, which lengthened its lead over second-place Atlanta to three games with the comeback win.
Ryan Mattheus (4-1) earned the victory with 1 2/3 scoreless relief innings.