WASHINGTON — One number on the Giants’ stat sheet stands out like a lion at a wildebeest convention: Mark Melancon, 0.00 ERA.

The onetime closer and source of much consternation since he arrived on a four-year, $62 million contract after the 2016 season has pitched the equivalent of a shutout in his eight relief appearances, no runs in nine innings.

Nobody saw this coming, perhaps not even Melancon, at least in March.

“Spring training was about as bad as it gets,” he said. “I don’t think I’ve had a spring that bad, but that’s why spring training is spring training.”

Something important occurred beneath the surface of that 9.45 Cactus League ERA. Eighteen months after undergoing surgery to release pressure on a forearm muscle that had nearly died because of compression, Melancon finally was able to throw pitch after pitch without pain.

Why did it go away?

Melancon has no idea, but he understands exactly why the lack of pain has allowed to pitch the way he has early in his third season with the Giants.

“For two years, every time I threw a baseball, no matter how far the distance or how hard, I felt pain,” he said, “and when your brain feels pain, it puts on the brakes, and there’s something that tells your body not to do that.”

Melancon’s mind was preoccupied with pain on every pitch, so he could not throw with conviction. Now he can. His velocity is up, he is throwing cutters and curveballs the way he wants, and he is one of just three major-league relievers to throw at least nine innings without allowing a run. The others are the Dodgers’ Dylan Floro and the Rays’ Diego Castillo.

Melancon has gotten help from defense and positioning. Five of the 19 outs he has recorded were “barreled,” defined by an exit velocity of at least 95 mph.

“As much as anything, he’s just throwing quality strikes down in the zone,” manager Bruce Bochy said. “His command is back. He’s got four pitches and throwing them all in the strike zone. He’s not making mistakes like he did last year.”

Bochy has no plans to restore Melancon to the closer role that he was paid big money to assume, but Bochy is using him in increasingly higher-leveraged situations. Melancon pitched the ninth and 10th innings of Friday night’s 18-inning win against the Rockies when the game was tied 2-2.

Henry Schulman is a San Francisco Chronicle staff writer.