Third baseman Jean Segura also went 3 for 5 with two RBIs in the victory at Nationals Park. The Phillies (11-14) have now won back-to-back games after a five-game losing streak.
Trea Turner gave Washington a 1-0 advantage with a leadoff home run in the bottom of the first inning. Phillies left fielder Andrew McCutchen then tied the score with an RBI single in the third inning before Realmuto stepped up to the plate three at-bats later.
The Phillies catcher worked an even count against Nationals starter Erick Fedde before he smacked a 1-1 fastball toward the right field fence. The ball traveled 99 mph before it drilled the padding on top of the outfield wall and bounced straight up.
Nationals right fielder Adam Eaton jumped and tried to catch the ball off the bounce, but it had just enough backspin to roll over the wall and into the Nationals bullpen for a 355-foot home run. The three-run shot gave Philadelphia a 4-1 edge.
"I didn't think I got all of it," Realmuto told reporters. "I was lucky enough that it carried enough and pretty relieved when it went over the fence.
"I kind of saw it out of the corner of my eye. I saw it hit the top of the fence, and then I didn't know if it came back in or over the fence, so I was ready to keep running to third."
Eaton got some revenge with a solo home run in the bottom of the sixth frame to cut the Phillies lead to two runs, but the Phillies responded down the stretch.
Roman Quinn gave Philadelphia a 5-2 lead when he scored on a fielder's choice in the top of the seventh inning. Phillies designated hitter Alex Bohm then plated Didi Gregorius with an RBI single in the top of the eighth.
Segura slapped a single to right field to plate McCutchen and Bryce Harper for an 8-2 lead in the top of the ninth. Nationals first baseman Asdrubal Cabrera scored the game's final run on a fielding error in the bottom of the final frame.
Phillies starter Jake Arrieta allowed three hits and one run in five innings to move to 2-3 on the season. Fedde allowed seven hits and four runs in five innings to take his second loss of 2020.
Phillies center fielder Roman Quinn went 2 for 4 in the win. Eaton and Cabrera each went 2 for 4 in the loss.
The Nationals (11-16) host the Phillies in the second game of the series at 6:05 p.m. EDT Wednesday at Nationals Park.