Danny Espinosa, left. Ivan Rodriguez and the Nationals notched their fourth walk-off victory in their last eight home games. (Ned Dishman/GETTY IMAGES)

Jayson Werth stood on second base late Monday afternoon, unaffected by what had preceded this crucial moment. Fans at Nationals Park had booed Werth as he peeled off batting gloves following a two-out, bases-loaded strikeout three innings earlier. He had been drilled by a fastball in the wrist the day before. He had hit .160 over the past month.

Werth cared about none of that. He studied the relief pitcher fresh into the game and surveyed the situation, one that gave him a chance to prove his value to the Washington Nationals even amid mighty offensive struggles: one out, tie score, extra innings. “I just felt like, it’s time to make something happen,” Werth said later. “It felt right.”

Within five pitches, Werth had stolen third base and bolted home on a wild pitch, completing a dash around the bases that sealed the Nationals’ latest delirious victory, 5-4 over the Chicago Cubs in 10 innings. Before 32,937, the Nationals’ fourth walk-off win in eight home games sent them back to .500 and validated Werth’s assertion that he can help the Nationals even as he slumps.

None of the Nationals’ previous wins materialized quite like this one, which Manager Davey Johnson managed with a roster diminished by a spate of injuries. Two starting pitchers pinch-hit with the score tied after the eighth. (“That’s a first for me,” Johnson said.) Laynce Nix played first base for the first time since high school. They overcame a two-run deficit in the final five innings while getting only one hit that left the infield.

In the end, Werth won it with a rally he created mostly by himself, with an assist from Livan Hernandez’s pinch-hit sacrifice bunt. Stuck in a vicious slump that has slashed his batting average to .224 in the first season of a seven-year, $126 million contract, Werth has endured boos often this homestand. When he bolted home in the 10th, his teammates mobbed him and the crowd cheered.

“Cheer me, boo me, whatever,” Werth said afterward, leaning on a couch in the Nationals’ clubhouse. “I’m still going to go out there and play my game.”

Even before he came to the plate, Werth had contributed without halting his offensive rut. He drove in one run with a broken-bat single and another with a weak groundout. He ended a Cubs rally in the sixth by throwing out a runner at home plate, his fifth outfield assist this season. Werth insists he’ll snap his slump. Until he does, he believes he can help with other means.

“I don’t worry about him,” catcher Ivan Rodriguez said. “I know that he’s going to hit and he’s going to put up some numbers for us. But those things he’s doing in the field, stealing the base, throwing a guy out at home plate, you don’t have to go 4 for 4 every day to say you’re a great player.”

The game lurched into 10th partly because of Werth’s at-bat in the seventh. Nix, who also tripled in the sixth, had drawn a bases-loaded walk to tie the game before Werth struck out with the bases loaded.

When Werth led off in the 10th, with a chance to play hero, he didn’t change his approach. Facing Marcos Mateo, he drew a walk. “I’m not afraid to take a walk,” Werth said. “I’m looking for a pitch, something to drive. The most important thing is getting on base.”

At the start of the inning, Johnson had told Hernandez he might call on him to sacrifice bunt if Werth reached first. During Werth’s at-bat, Hernandez retreated to the batting cage down the tunnel from the Nationals’ dugout and practiced bunting.

After Werth walked, Johnson pulled catcher Wilson Ramos back from the on-deck circle and sent Hernandez to the plate. He deadened the first pitch Mateo threw and sent the ball toward the first base line, a “blueprint” bunt, Johnson said.

With Werth on second, Mateo felt pain in his elbow and had to leave the game. Cubs Manager Mike Quade summoned Carlos Marmol, one of the nastiest relievers in baseball, a right-hander whose pitches dart and dive like balloons losing air. He jogged in to face Ivan Rodriguez with scant notice, like a startled contestant on “The Price Is Right.”

In the batter’s box, Rodriguez noticed Werth creeping off the base, little by little, as Marmol neglected him. With one out, Werth considered the advantage of moving from second to third worth a considerable risk. He knew if Marmol raised his front leg and spun to pick him off, “I would be the goat,” Werth said. But he felt comfortable that a pitcher fresh into the game, who was used to pitching at the start of an inning, would not.

“I think he started running before [Marmol] threw the ball,” Rodriguez said.

Marmol threw a fastball down the middle. Rodriguez normally would have swung at it, but he knew Werth had made such a perfect jump. “You have to take a pitch,” he said. Rodriguez did, for a strike. Werth slid into third base without a throw from Cubs catcher Geovany Soto.

“There was no sign for that,” Johnson said. “It was just his read, and boom, he’s over there. That’s a winning attitude.”

Said Nix: “It surprised everybody I think, them and us. He’s always thinking. He’s always on his toes. He never stops playing the game. And that’s admirable.”

With Werth 90 feet away, the Cubs drew their infield in. Rodriguez worked Marmol to a 2-2 count. Marmol threw him a slider, meant to be off the outside portion of the plate, to tease Rodriguez into swinging. Instead, it landed in the left-handed batter’s box, skipped by Soto and rolled to the backstop. Rodriguez windmilled his right hand, waving Werth home. “I almost dislocated my arm,” Rodriguez said.

Werth scampered home, sprinting over the plate without any resistance. He raised his arms as the Nationals exploded out of the dugout and created another dogpile. The Nationals have gone 12-2 in their last 14 games decided by one run or in extra innings, and they have outscored opponents, 27-7, after the ninth inning.

They’ve won many of those games despite Werth’s struggles. Monday, even if he hasn’t broken his slump, they won because of him.

“You get hot, you get cold, you keep hustling, you keep playing the game hard,” Werth said. “Do it the right way. Helping your team win, I think that’s the most important thing.”