The Nationals’ Jonny Gomes is hit by a pitch with the bases loaded allowing Ryan Zimmerman to score the 10th inning . (John McDonnell/THE WASHINGTON POST)

In Jonny Gomes’s mind, there’s a rule of thumb when batting that harkens back to his days at Santa Rosa Junior College in his native Northern California. The inner half of the plate is his, the outer half of the plate is the pitcher’s. And if a pitch dares come inside and close to your arm or body, well, quite simply, you hang in there — or as Gomes described it, “hard-nosed dirt-bag baseball. That’s how we played.”

So when Phillies reliever Brad Lidge’s slider came in high in the bottom of the 10th inning with the bases loaded and only one out, Gomes did what he had always done before: stood there, braced himself and took the pitch off his arm. And with it, a game filled with dramatic moments ended in one of the most unusual of fashions: a walk-off hit-by-pitch that scored Ryan Zimmerman for a 5-4 win over the Phillies before an announced crowd of 41,727.

“Getting hit was last on my to-do list in that at-bat,” Gomes said with a chuckle.

Sunday’s wild game against the Phillies (81-44), baseball’s best team, was anything but normal. The Nationals pestered starter Roy Halladay enough to trail 3-2 in the sixth inning, but they found a blessing in disguise in the form of a 71-minute rain delay that drove the ace out of the game. The third-place Nationals (61-64) twice tied the game late on solo home runs by slumping players.

“That’s what we’ve been doing all year,” said shortstop Ian Desmond, who hit one of those late-inning homers. “We’ve been grinding all year.”

A Phillies fan calling himself “Cheesesteak Head” is shown during the Washington Nationals defeat the Philadelphia Phillies. (John McDonnell/THE WASHINGTON POST)

Desmond’s home run in the ninth inning came in a dramatic situation: The Phillies led 4-3, reliever Antonio Bastardo had notched two outs and had a 1-2 count on Desmond.

But Desmond, a .230 hitter this season who was familiar with Bastardo from the upper minor leagues, drove the fourth pitch of the at-bat just over the left-field fence.

It was the second time the Nationals had clawed back to tie the game.

Three innings earlier, with the Phillies leading 3-2, second baseman Danny Espinosa welcomed Halladay’s rain-delay replacement, reliever Michael Schwimer, a St. Stephen’s/St. Agnes graduate who was making his major league debut. Espinosa smashed the second pitch from the 6-foot-8 reliever nearly 440 feet into deep center field to tie the game at 3. It was the only run Schwimer allowed in three innings.

For the first five innings, Nationals starter Chien-Ming Wang had admirably dueled with Halladay, one of the game’s best pitchers.

Wang — who has been slowly building his strength and consistency since a major shoulder injury forced him out of the majors for more than two years — showed improvement, throwing 89 pitches, 59 for strikes, over 52 / 3 innings, allowing three runs and striking out four batters. If it weren’t for the rain delay in the sixth inning, “I’d have given him 100 pitches,” Manager Davey Johnson said. “Easy.”

At times, Wang’s trademark sinker worked. The tailing, dipping pitch induced 10 groundouts.

Ryan Zimmerman (11) is greeted by teammates after crossing the plate for the winning run in the 10th inning. (John McDonnell/THE WASHINGTON POST)

At other times, it failed. A sinker that wasn’t low enough to Chase Utley in the third inning was hammered to right-center field for a home run. An inning earlier, Carlos Ruiz hit a two-run homer, albeit on a much better sinker than the one to Utley, into left field.

From the start, the Nationals looked poised against Halladay, as they had the last time they faced him. On May 30, Halladay gave up 10 hits, four earned runs and three home runs — his most in one game all season.

On Sunday, the Nationals scored two runs in the first inning, led by Desmond’s leadoff double, and forced Halladay to throw 27 pitches.

After Wang’s exit, Johnson used a combination of Tom Gorzelanny, Todd Coffey and Tyler Clippard to get to the ninth inning without allowing the Phillies to score again. But in the top of the ninth, closer Drew Storen seemingly gave it away. He walked Raul Ibanez and gave up back-to-back singles. Former Nationals farmhand Michael Martinez smacked Storen’s first pitch up the middle to score Ibanez for a 4-3 lead.

But that would set the stage for Desmond’s dramatic, two-out home run in the bottom of the inning and for Gomes’s walk-off heroics. Sean Burnett pitched a scoreless 10th inning for the win.

In the bottom of the 10th, Zimmerman led off with a double, followed by an intentional walk to Michael Morse and a single by Jayson Werth.

After Espinosa struck out, Gomes strode to the plate, ready to play his brand of baseball.

It was a long, winding and unusual game, enough to prompt Johnson to sit down before reporters following the win and immediately utter to a room full of chuckles: “That was fun.”