Bryce Harper hit two home runs, including one with two outs in the ninth, as the Nationals rallied to beat the Phillies, 6-4, on Sunday at Nationals Park. (Katherine Frey/The Washington Post)

After his second home run of the game bailed the Washington Nationals out of another late-inning debacle, Bryce Harper did not jog into the mosh pit at home plate, nor did he skip, as others have before him. He leaped, a few feet off the ground, a few feet above the fray, high enough that if time had stopped right then, he could have looked down at the dozen or so giddy teammates he had just lifted from the brink.

The Nationals nearly lost Sunday’s game at Nationals Park in the same demoralizing way they lost a handful of others this season. They made mistakes on defense. They failed to get key outs late. But none of it mattered because their transcendent talent transcended it all again.

“I was telling him earlier in the game that in another four or five years he’s going to be a pretty good player,” Nationals left fielder Jayson Werth said. “I think he proved me wrong once again. That was huge. Bailed us out big time.”

Down 0-2 in the count and a run in the game with two outs in the ninth, Harper battled back to a full count, then buried a ball in the batter’s eye, 423 feet to dead center field. The Nationals, who looked destined for a loss and a .500 record, suddenly had a 6-4 win and a 7-5 record before what promises to be one of the more grueling road trips any of them have experienced.

“That’s how Easter is supposed to be celebrated, with a walk-off done by the right man,” Nationals starter Gio Gonzalez said. “Bryce, right on cue. That man is the real deal.”

Harper had homered earlier, too — a two-run shot in the third inning that gave the Nationals the lead they ultimately gave back late. He has four home runs this season and is hitting .333 with a .455 on-base percentage. No Nationals regular has gotten on base at a higher rate.

The first homer gave Gonzalez a 3-1 lead he seemed determined not to give back. Though he walked more men (unintentionally) in the first four innings than he walked in his first two starts combined, frequent visits from catcher Matt Wieters and the rest of the infield seemed to calm him down.

He pitched into the eighth for the first time all year. He got an out in the eighth for the first time since August 2015. He did not finish the eighth because he allowed back-to-back singles to Cesar Hernandez and Daniel Nava, the second of which Werth misplayed, which allowed Hernandez to score and put the tying run in scoring position at second base.

“It was the eighth inning. I haven’t seen one of those in a while, so I’ll take it for what it was,” Gonzalez said. “I’m just happy to be out there, showing great signs of improvement.”

Manager Dusty Baker, who had Koda Glover ready in the bullpen before Nava’s at-bat but stuck with Gonzalez anyway, pulled the lefty after that. Baker said later he considered pinch-hitting for Gonzalez in the sixth but was hesitant given the bullpen’s recent struggles. Those struggles derailed things anyway because after Nava’s hit, Glover threw a low slider Wieters could not block, and Nava moved to third. Tommy Joseph singled, and the game was tied.

Blake Treinen started the ninth. He fell behind the first hitter he faced 3-0 and could not escape unscathed; Aaron Altherr eventually doubled, then moved to third on a groundout. Altherr scored the go-ahead run when Wieters dropped Daniel Murphy’s throw home on a groundball to second. Baker said home plate umpire Greg Gibson told him Altherr probably would have been safe even if Wieters held on. Wieters admitted he misplayed it and tried to rush the catch in favor of the tag.

But as Treinen lurched through the rest of that inning, allowing another hit and walking a batter, the bullpen’s inability to avoid trouble in the first place again seemed likely to undo a good day’s work. The Nationals’ new closer is now pitching to a 6.00 ERA with four walks and eight hits in six innings.

“I think it’s more concentration and trying too hard more than anything. I know he has confidence,” Baker said. “. . . He’s still learning. I’m hoping he’s a quick learner.”

Baker and the Nationals are not alone in their early season wrestling match with bullpen inconsistency. Joaquin Benoit became the Phillies’ closer last weekend, when the Nationals battered former closer Jeanmar Gomez so much the team demoted him. Benoit allowed a walk to Chris Heisey and a single to Adam Eaton, which put him in a two-out, two-on situation for Harper. Benoit got ahead 0-2. Harper battled back into a 3-2 count.

At that point, Harper thought Benoit might throw him a change-up, one of the more troublesome weapons in the righty’s arsenal. Instead, he threw a fastball, right down the middle. Harper did not miss it and turned another late-inning chance into late-inning magic.

“He’s getting better at it,” said Baker, whose postgame demeanor was not one of unqualified joy like the Nationals showed at home plate a few minutes earlier. His reaction was one of qualified relief, an uneasiness at the circumstances that nearly sunk his Nationals again, a gratitude for the player who pulled them out of the fire at the last possible moment.

“We made mistakes, and it cost us,” Baker said. “And then Bryce erased them.”