Matt Stairs, with helmet, is congratulated by his Nationals teammates after his game-winning hit off the right field wall. (Greg Fiume/GETTY IMAGES)

Davey Johnson became one of the most accomplished managers of his generation largely by building confidence in his players, by knowing even 43-year-olds sometimes require reassurance. In his first major league victory in 11 years, Johnson, 68, proved he still possesses that skill.

Friday against the Pittsburgh Pirates, the Washington Nationals’ manager called on veteran Matt Stairs, whose batting average resembled the price of a cheap cup of coffee, during the game’s most pivotal moment.

“One out, winning runner on third?” Johnson said. “He’s the guy I want up there. I don’t care if he’s hitting .080.”

Stairs delivered a pinch-hit, walk-off single off the right field wall at Nationals Park, a line drive that missed going over the fence by inches, scoring pinch runner Alex Cora and sending the Nationals back to .500 with a 2-1 victory.

Johnson had won a World Series and 1,148 regular season games before Friday, but his first victory in four games with Washington ranked among any of them.

“This became an all-time memory, right now,” Johnson said. “First win in 11 years, to get it in front of the home crowd, it was special.”

Stairs’s first walk-off hit with the Nationals — the role he was brought here to fill — preserved Tom Gorzelanny’s outstanding start. When Stairs hit the ball, the 22,399 fans in attendance — many of whom surely have maligned Stairs at some point this season — exploded. Stairs trotted to first, touched the bag and turned, his arms raised, awaiting his teammates. A few minutes later, Jerry Hairston smeared a whipped-cream pie in his face.

Stairs’s shining moment began, really, Monday afternoon in Anaheim, Calif., when he walked into the clubhouse and saw his name in the lineup for the third time all season. Johnson kept him in as the team’s designated hitter on Tuesday, too, even after a left-handed reliever entered to face him. Stairs smacked a single for his first RBI of the year.

“That gave me a lot of confidence,” Stairs said. “I was starting to walk back into the dugout. He believes in you. He knows that earlier in the season was tough as far as not getting at-bats. My timing was off.”

During his 11 at-bats in three games in Anaheim, Stairs started to figure out his swing and find his rhythm. Friday afternoon, he chatted with Johnson about his approach. Johnson told him he had lost his aggressiveness, taking too many pitches.

“He was right,” Stairs said. “I started thinking too much, trying to take the ball to left. I needed to take my same approach. I’m a pull hitter.”

Stairs resolved to relax, swing easy and let the pitcher’s velocity generate power for him. Following batting practice Friday, he did not touch a bat or bother staying warm in the cage behind the Nationals’ dugout. He watched as Gorzelanny twirled a gem — no earned runs in seven innings, six hits, one walk and eight strikeouts, all swinging — and as Roger Bernadina tied it at 1 with a solo homer to lead off the sixth.

After Pirates reliever Chris Resop struck out Jayson Werth, Ryan Zimmerman and Laynce Nix consecutively, with two men on base in the eighth, the Nationals remained tied entering the bottom of the ninth.

Michael Morse ripped the first pitch he saw from reliever Tim Wood up the middle for a leadoff single. With Danny Espinosa squaring to bunt, Wood uncorked a wild pitch, sending Morse to second base. With two balls and first base open, Pirates Manager Clint Hurdle — perhaps aware of Espinosa’s growing cache of clutch hits — ordered an intentional walk. Johnson replaced Morse with Cora, figuring he had better instincts on moving up for a bunt.

Wilson Ramos squared to sacrifice but laid off an outside fastball, knowing he couldn’t bunt it toward third, the only place that would ensure the lead runner would not be retired. Instead, Ramos lifted a 1-2 pitch deep to right, pushing Cora to third base.

Stairs watched Ramos’s at-bat from on deck, still practicing relaxation — “I don’t know if I took one swing,” he said. In the dugout, Johnson had not forgotten the importance of confidence. When he sent Stairs to pinch-hit for Ian Desmond, he told Desmond: “You’re not swinging the bat the way I know you can. I normally wouldn’t do this.”

So in came Stairs, batting a cool .132 with one RBI. On some occasions, when the Nationals needed a roster spot after a teammate returned from the disabled list, he had wondered about his status. But he never doubted his ability.

“I still believe I can come off the bench and hit anyone’s fastball,” Stairs said. “I still believe that when I come up to the batter’s box, I still put some fear into the other team’s manager.”

Wood fired a 95-mph fastball and Stairs dribbled it foul — “bad swing,” he said. Wood came back with another fastball on 0-1, 95 mph again. Stairs used his old pull swing, blistering a line drive to right. He knew right away. Cora strolled home, and the Nationals mobbed Stairs.

Back in his office, Johnson assured reporters he would give starting pitchers “a longer leash.” Gorzelanny had earned it with his performance, stretching a streak of innings by Nationals starters without allowing an earned run to 15.

Johnson had never come home from Nationals Park so late, and he worried about the directions. He had not kept the game ball, and he had no real plans to celebrate his first win in Washington.

“I’m looking for the second now,” he said.