The Phillies have been in a funk since they clinched their fifth straight division title on Saturday. They've lost five straight games for the first time since May 22-27, 2010. All of the losses have come at home, where the Phillies are tied for the major league lead with 52 victories.
Espinosa's two-run shot in the sixth off Vance Worley (11-3) made it 4-3 as the Nationals continued to give Philadelphia fits. Washington swept a doubleheader on Tuesday and go for the four-game sweep on Thursday.
John Lannan (10-13) allowed eight singles and three runs in five innings. Henry Rodriguez worked the ninth for his first save.
The Phillies played again without right fielder Hunter Pence and first baseman Ryan Howard. Howard has been out with a sore left ankle and Pence missed his second straight game with patellar tendinitis in his left knee. Both players are expected to play in Philadelphia's weekend series at New York.
With postseason plans underway, the Phillies aren't too worried about this slump. Manager Charlie Manuel said before the game he needs his regular lineup in tact for at least the last four or five games of the regular season to tune up for another potential deep postseason run.
"We definitely need to have our team ready and I plan on our team being ready," Manuel said.
They haven't looked it against Washington.
Backed by Espinosa's go-ahead homer, the Nationals won their seventh straight road game. His 21st homer set a single-season franchise record by a rookie. The Nationals (75-79) still have a chance to set a franchise record for victories in a season. They will need to finish 7-1 to reach 82 wins, and finish with their first winning record since moving from Montreal in 2005.
Worley had fit in nicely in a rotation that included Cliff Lee, Roy Halladay, Roy Oswalt and Cole Hamels, winning nine straight games in one stretch and becoming an instant fan favorite with his Mohawk and "Vanimal" nickname.
He'll be bumped to the bullpen for the playoffs and this was his last start of the season.
Worley had a 43-inning streak this season without allowing a homer, but he was done in by them on Wednesday. Ramos made it 2-0 in the second with his 14th homer of the season.
The Phillies tied it at 2 in the second on five straight singles off Lannan. Ben Francisco's single up the middle made it 2-1 and Worley tied it with his own base hit.
Raul Ibanez's RBI single in the third put the Phillies up 3-2. That was all they could muster against Lannan.
John Mayberry Jr. hit a two-run homer in the eighth for the Phillies that made it 7-5.
Howard and Pence have combined for 53 homers and the Phillies could have used some of that pop in the lineup. The Phillies scored only three runs in the doubleheader defeat and have been shut out twice over the five-game losing streak. They've scored three runs or less 13 times in the last 14 games.
That kind of anemic run support will shift even more pressure to produce on the Lee-Halladay-Hamels-Oswalt postseason rotation. Even the so-called "Four Aces" need more than a run or two each start if the Phillies are going to win the World Series for the first time since 2008.
Ramos added an RBI single and Jonny Gomes had a sacrifice fly during Washington's three-run eighth to open up a cushion. Lannan improved his career record vs. the Phillies to 2-12.
Notes: The Nationals beat the Phillies for the eighth time in 10 games (4-1 at Nationals Park; 4-1 at Citizens Bank Park). ... The Phillies lost five straight home games for the first time since June 16-21, 2009. ... The Nationals send RHP Brad Peacock (1-0, 1.42 ERA) to complete the sweep Thursday against Oswalt (8-9, 3.66).