Washington’s Ian Desmond, left, scores just ahead of the tag by Cubs catcher Welington Castillo in the first inning to give the Nationals an early lead. (Charles Rex Arbogast/Associated Press)

The Washington Nationals gave themselves every possible chance to fail Tuesday night at Wrigley Field. They had produced 16 base runners through the game’s first eight innings, yet had only a 2-1 lead to show for their effort. Finally, Ian Desmond and Denard Span had had enough.

Desmond singled to score Bryce Harper, who had led off the ninth with a double. Span then added a two-out single for another insurance run. When Rafael Soriano yielded a leadoff home run to start the bottom of the inning, the runs loomed even larger. Soriano settled down to retire the final three Cubs in order, and the Nationals survived with a 4-2 win a night after they suffered an 11-1 shellacking.

“Some of the ways we’re finding ways to get out is unbelievable,” Desmond said. “It’s bound to change at some point. It did in the ninth, and hopefully we can continue to do that and hopefully it carries over.”

Dan Haren gave the Nationals the chance to own Tuesday’s game, pitching six strong innings, holding the Cubs to one run on five hits, striking out six. Behind him, the back end of the Nationals’ bullpen — Drew Storen, Tyler Clippard and Soriano — delivered.

Haren fooled Cubs hitters with his second-half focus on keeping the ball low and changing speeds. Haren has a 2.16 ERA since July 8 and his eight wins this season are second most on the team, behind only Jordan Zimmermann.

Still a little tired from his career first save in Saturday’s 15-inning win in Atlanta, Haren managed 103 pitches. He had trouble getting loose warming up, and the first two innings were a struggle, but he allowed only a solo home run in the fourth by Brian Bogusevic.

“My stuff was just average,” Haren said. “In the beginning of the year, I was throwing harder and my stuff was nasty, but I was just getting burned by the homers. That one mistake would just kill me. I’ve been able to kind of stay away from that.”

The turnaround has not gone unnoticed.

“It’s been unbelievable,” Manager Davey Johnson said.

The Nationals’ offense did “just enough,” as Johnson put it. Tuesday’s lineup was part of Johnson’s effort to address one of the team’s season-long weaknesses — hitting left-handed starters. Right-handers Scott Hairston and Tyler Moore were in the lineup against left-hander Chris Rusin. Hairston started in left field and Harper shifted over center, while Moore started at first base. Harper, Johnson reasoned, needed the opportunities to improve.

The moves provided a lift. Harper laced the game’s second pitch into right field for a single. Desmond then hit into a fielder’s choice before Ryan Zimmerman drilled a double down the left field line that scored Desmond and gave the Nationals a 1-0 lead.

The game then descended into a string of failed offensive opportunities, perhaps the most dominant running theme of this season. The teams were hitless in 12 at-bats with runners in scoring position through the first five innings.

The Post Sports Live crew discusses how the Nationals should have handled Bryce Harper's hit by pitches during the Braves series. (Post Sports Live/The Washington Post)

“Don’t even go there,” Johnson said when asked about the stranded runners. “I struggled through that one. We were lucky to get two runs in the last inning.”

The Nationals took a 2-1 lead in the sixth when Zimmerman led off with a double and came around to score on Moore’s single in the hole to short. The Nationals ended up leaving the bases loaded to end the inning when Haren was unable to help his own cause, grounding to short.

Storen needed only 13 pitches to induce two groundouts and a flyout in the seventh. Since his return from his stint in the minor leagues to correct his mechanics and regroup, he has fired four scoreless innings and retired 12 of the 13 batters.

For the first time in a while, Johnson could turn to the ideal order of the back end of the bullpen. Clippard worked a scoreless eighth inning, aided by two warning track catches by Jayson Werth and Span. Soriano, who had blown his previous two save chances, allowed the leadoff homer to Donnie Murphy to open the bottom of the ninth inning. It felt like the same recent script all over again. But he recovered and completed the inning, helped by the crucial runs scored only minutes before.

“We had opportunities earlier in the game to blow the game wide open and we didn’t do it,” Span said. “Thank God we were able to get some more opportunities later in the game.”