Jayson Werth and Bryce Harper account for five RBI on Friday night in Kansas City as the Nationals overcome a dismal start from Gio Gonzalez (3.1 innings, 9 hits, 6 earned runs) to get back to .500 at 64-64. (Orlin Wagner/Associated Press)

The Washington Nationals overcame a familiar quandary Friday night with an uncommon solution. They faced disaster, hit their way out and hung on for dear life. After the Kansas City Royals bludgeoned Gio Gonzalez, an offense that had shriveled under most any scenario exploded in dire circumstances. And when an unlikely savior came out of the bullpen and posted five zeros, a blowout loss turned narrowly into a small milestone.

Their slog of a season has forced the Nationals to amend their goals, and they hit one Friday night at Kaufman Stadium with their 11-10 victory. Their fourth straight win, which came only after they survived a nightmare ninth inning, pushed the Nationals back to .500 for the first time since July 19.

It came after a loopy game the Nationals at first refused to give away, then, in adherence with their ulcer-inducing road trip, nearly did at the end. The Nationals remained 8 ½ games out of the second wild spot, but another win allowed them to cling to optimism.

“We got no other way to feel,” said Jayson Werth, who ripped a go-ahead, two-run homer in the fourth. “We got nothing left. This is it.”

Bryce Harper delivered both the lodestone of their seven-run fourth inning and a game-saving catch in a calamitous ninth inning. Tanner Roark protected the well-earned lead with 4 2 / 3 scoreless relief innings, providing shelter for a weary bullpen and earning his fourth win in his sixth career appearance.

“How about Roark?” Manager Davey Johnson said. “Unbelievable job.”

Johnson called on Drew Storen to protect a four-run lead in the ninth and then pulled him after he walked one batter and gave up a double. Johnson fumed that Storen, who had retired 15 of 16 hitters since coming back from Class AAA, had not been more aggressive with a large lead. Rafael Soriano, the closer whom Johnson deemed unavailable earlier in the day, replaced Storen. He walked off the field with a look of boiling disbelief.

“He can be mad at me,” Johnson said. “But he should be mad at himself.”

Soriano yielded two hits, including a two-run single by former National Justin Maxwell that made it a one-run game with one out. Soriano has been shaky lately, and another disaster seemed imminent. With one out, Nationals outfielder moved back into “no doubles” defense, trying to ensure Maxwell could not score from first.

The alignment backfired when Emilio Bonifacio skied a fly ball to shallow right field. “I knew when the ball was hit, it was going to be a tough play,” Werth said.

Harper darted in. He threw himself at the ball and made a sliding catch, his fully extended as he snatched the ball from the tips of the grass. Harper landed hard on his right hip and knee, which have bothered him all season. From across the field, Werth worried Harper had re-injured his knee. Harper keeled over as he walked back to his position, but he stayed in the game.

“You’ve got to make the catch in that situation, no matter what,” Harper said. “Bonifacio can run a little bit, so if I drop that ball, he’s probably on third base and that guy probably scores. It was a huge play.”

One pitch later, a pop to shallow left ended it.

Earlier in the day, the Nationals’ front office sent a small signal about its view of the season, shipping veteran catcher Kurt Suzuki away for a prospect, the kind of move a team makes as a concession. At night, the Nationals played against type.

Gonzalez may walk too many batters and nibble around the plate, but rarely will an opposing lineup blister his lively fastballs and late-breaking curves. Friday night, from the start, the Royals pounded him. He could not find his usual arm slot, and his pitches sailed high. At one point, pitching coach Steve McCatty trudged to the mound and told him, “Keep the ball down. Get your arm on top.”

“Trust me,” Gonzalez replied. “I’m trying to get that arm up.”

Alex Gordon led off with a double, and Eric Hosmer followed with a two-run homer. Maxwell added another blast in the first. By the end of the second, Gonzalez trailed, 6-0.

The Nationals’ fourth-inning explosion began with a tiny moment. Ian Desmond, who had sat the previous game with a stiff back, singled to lead off the inning. Wilson Ramos grounded to third, Desmond barreled into second base in a way few players would on a steamy Kansas City night, down six runs and mired in a mediocre season.

Desmond slid hard and rolled into second baseman Chris Getz’s feet, negating the Royals’ chance at a double play. When he returned to the Nationals’ dugout, Desmond walked the length of the bench and received a high five or fist pound from every teammate. Maybe it was nothing; maybe it reminded the Nationals they didn’t need a good reason to play hard.

“It fired me up, definitely,” Harper said. “Everybody in the dugout was fired up about that. We’re playing this game hard. Having one of our leaders go into second base like that and try to break something up is huge.”

The next two Nationals singled, and Anthony Rendon knocked in a run with a sacrifice fly. Denard Span walked to load the bases with two outs, and Ryan Zimmerman drew another walk to force in the Nationals’ third run.

All of a sudden, Harper walked to the plate as the tying run in a testing moment. When starter Bruce Chen struck him out looking in the first, it made Harper 19 for 100 this season against left-handed pitchers.

Chen put Harper in a 1-2 hole, starting him with two sliders and then throwing an even slower breaking ball, a 71-mph beach ball that Harper fouled away. Chen tried to finish off Harper with a sinker, and he fouled it away. He tried another sinker off the outside corner, and Harper took it for ball two.

Chen tried again to fool Harper. He twirled a 74-mph curveball. Harper waited as the pitch fluttered toward the plate, holding his front shoulder closed, storing his power. He waited a beat longer. Finally, Harper swung. He ripped a line drive to the right-center field gap, and the ball skipped to the wall. All three runners raced home. Harper straddled second base, clapped and pointed to the dugout.

The Nationals, incredibly, had turned a five-run deficit into a tie game in one inning. They were not done. Royals Manager Ned Yost yanked Chen in favor of right-handed reliever Louis Coleman to face Werth.

“Whenever you play these interleague games, you don’t really see these guys,” Werth said. “You watch them on video, but that doesn’t mean anything.”

Werth fell into an 0-2 hole, which is not as dire for him as most hitters. Across the league, hitters have batted .162 this year after the count goes 0-2. Werth has hit .209, far from hopeless.

“I’m comfortable there,” Werth said. “It’s not where you want to be. My approach doesn’t change.”

Coleman tried to make Werth chase a slider on three consecutive pitches, and Werth would not bite. “I figure if he throws me four sliders there and gets me out, just kind of tip your cap,” Werth said. He sat on a fastball, and Coleman threw one down the chute, 93 miles per hour. Werth crushed it 417 feet to left-center field, a two-run home run that gave the Nationals their biggest inning of the season and an 8-6 lead.

Given a lead to work with, Gonzalez could not solve his problems. The first three Royals reached base, which scored one run, and Billy Butler hit a screaming liner at Span in center field for the first out. Johnson ambled to the mound, took the ball from Gonzalez and summoned the Nationals’ unlikely godsend.

When August began, Roark was an anonymous Class AAA starter. Less than a month later, he has become a relief ace. Roark threw 37 pitches Wednesday, and after one day of rest he arrived at Kaufman Stadium early and played long toss with Craig Stammen. He felt good enough to pitch again.

Roark immediately wrangled out of the jam Gonzalez left him with a double play. It began 4 2 / 3 innings of scoreless relief, during which Roark allowed one hit and one walk, throwing another 58 pitches. He won his fourth game in six appearances and lowered his ERA to 1.10.

“I knew it was going to be a long one out there,” Roark said. “I was just giving it everything I’ve got for as long as I’ve got.”

The Nationals tacked on three runs in the seventh, aided by second baseman Getz’s two-run throwing error. The Nationals had so often been the one steamrolled by an opponent, the team that produced competing nadirs. For once, they had fought back.