Bryce Harper had Juan Pierre’s fly ball in his glove momentarily before losing it after a rough landing on the warning track Friday night at Nationals Park. Harper was 0-for-3 with three walks and two strikeouts. (Jonathan Newton/The Washington Post)

Nationals Park was ready to burst. The fans standing late Friday night, with the bases loaded and two outs in the 11th inning, Bryce Harper on second base and Stephen Strasburg watching from the dugout, the Philadelphia Phillies dangling by a thread, were rooting for the home team, for the Washington Nationals.

Wilson Ramos gave them a reason to finally explode. Just into the game as a pinch hitter, the last man available, Ramos hit a soft line drive to left-center field and raised both arms. Steve Lombardozzi sprinted home from third base and threw his helmet. The Nationals mobbed Ramos at first base, celebrating a 4-3, walk-off victory before 34,377, a crowd the Nationals had cultivated by not selling tickets to the Phillies fans who had marauded from the north for years.

“A lot of places to start in this one,” Manager Davey Johnson said afterward, collapsing into a chair. Thirty-players appeared, but only three umpires after crew chief Joe West came down sick. Strasburg allowed his first homer in almost two years, then allowed another three hitters later. Harper went 0 for 3 with two strikeouts and three walks, including a crucial free pass in the 11th. The Nationals left 14 men on base. “That’s a crazy game,” Jayson Werth said.

When it ended, the Nationals (17-9) had their ninth one-run victory of the season and their fifth-walk off win. Going back to last year, the Nationals have won six consecutive games against the Phillies, and are 41 / 2 games clear of them in this year’s National League East standings.

“They kind of have a bigger feeling when you’re playing the Phillies,” Johnson said. “I felt they were the best team in baseball last year. To come in and beat them the first time in our house . . . it was a big game for us, and I’m sure the Phillies felt the same way, because we’re sitting on top.”

It took until an hour before midnight, when the Nationals had one out left and the bases empty in the 11th, to complete a comeback from down 3-1. Lombardozzi, the rookie forced into playing third with Ryan Zimmerman on the disabled list, rolled a two-out single into right off Fairfax native Michael Schwimer. Up came Harper, who had led off the ninth with a strikeout against Schwimer, chasing a slider.

Harper took a wicked hack at the first pitch and fouled it back. He smoked the next down the first base line, just foul. Down 0-2, he spit on the next three pitches, a high fastball and two sliders in the dirt. Schwimer tried one more slider outside, and Harper refused to bite. Even in the biggest moments, he will not cave. He’ll take the walk.

“He knows the game,” Werth said. “He has a pretty good feel for the game, I feel like. He manages to stay calm and within himself. It’s impressive.”

Werth, who had left five men on base in his first two at-bats, drew a clutch walk of his own. Up came Ramos.

Ramos started the game on the bench, which for a catcher usually means a night off. Johnson is loath to use his second catcher, risking a position player — Lombardozzi, in the Nationals’ case — entering the game behind the plate in case of injury. Ramos ate sunflower seeds and chatted with teammates.

“I was the last option,” he said.

As the game wore on, and after Jesus Flores tied the game with an RBI double in the eighth inning, Ramos knew he might be needed. He started taking hacks in the batting cage behind the Nationals’ dugout. With the pitcher’s spot up behind Werth, Johnson called on Ramos.

“At that moment, I just take my batting gloves and say, ‘Okay, I’m the man. Hit the ball hard,’ ” Ramos said.

Ramos checked with hitting coach Rick Eckstein, who told him to watch Schwimer’s slider. Ramos fell behind in the count, then took one ball and fouled off another pitch. With the count 2-2, he looked for a slider. Schwimer threw a hanger. Ramos lined a single to left-center.

The place erupted. At first base, the catcher who spent 48 hours this winter as a kidnapping victim watched his teammates rush at him. Shaving cream stung his eyes. He thought Flores, his fellow Venezuelan, was the culprit. Flores admitted to smearing it, but said a different teammate had brought the shaving cream out to the field.

At home plate, Lombardozzi smashed his helmet to the ground. “I was freaking out,” he said. “I threw my helmet and got to Ramos as fast as possible. I was saying to myself, ‘Did I hit home plate? I hope I did.’ You try to win in nine, but it’s exciting to get it done like that.”

The Nationals struck to their usual script, making sure nothing that happens before the eighth inning really means anything. The fans who trickled out of the park may have forgotten Strasburg actually started the game. He struck out Jimmy Rollins, the leadoff hitter, on three pitches, erasing him on a 91-mph change-up that dropped like a Looney Tunes anvil. Strasburg did not allow a hit or walk in the first three innings.

When Hunter Pence walked to the plate in the fourth inning, after Strasburg doubled, Strasburg had not allowed a home run since Adam LaRoche, then an Arizona Diamondback, smashed one against him on August 15, 2010. He had pitched 66 innings since. Entering Friday, 72.4 percent of the batters he faced in 2012 either struck out or grounded out.

Strasburg threw Pence a first-pitch, 80-mph curveball, a sneak attack for strike one. Only Pence was ready. The ball landed in the red seats, giving the Phillies a 2-0 lead.

Chad Tracy responded for the Nationals, leading off the bottom of the inning by golfing a curveball down the right field line into the home bullpen, just his second hit since April 7.

To lead off the fifth, Strasburg threw one curveball, which Carlos Ruiz took for a strike. He tried one more, and Ruiz drilled a home run just over the center field fence. Before the fourth inning Friday night, only one right-handed batter, Dan Uggla, had ever hit a home run against Strasburg. Now, the last two right-handers he faced had sent a curveball over the fence.

“I just left a couple pitches up,” Strasburg said. “It’s an adjustment. It’s a couple pitches that could have gone differently.”

In the end, the Nationals extended the distance between them and the five-time reigning division champions. Late Friday night, music blared in the Nationals’ clubhouse. On a hook next to Ramos’s locker, a red cap hung, covered in shaving cream. Outside the stadium, fans went home happy, except the ones driving all the way back to Philadelphia.