Juan Soto walked into the batting cage determined to find out what was wrong. It was sometime after midnight following Game 3 of the National League Championship Series against the St. Louis Cardinals. The 20-year-old didn’t feel like the phenom he was; he had finished hitless in three at-bats and struck out twice. Soto had delivered two of the Washington Nationals’ most crucial hits of the postseason — the go-ahead single in the wild-card game and the game-tying home run in Game 5 of the NL Division Series — but otherwise he felt as though he was flailing.

The batting cage at Nationals Park sits in what looks like an alcove of the hallway between the clubhouse and the dugout. But inside, it’s cavernous with green carpet cordoned into lanes by mesh nets. Underneath the bright lights, the ones that can make you forget what time it is, Soto explained to hitting coach Kevin Long that he suspected his struggles in the postseason — 7 for 34 overall (.206) — were caused by pulling his front hip. Long agreed; the young star was out in front of everything.

Hitting obsesses Soto. He considers it a kind of art. He hones his swing as craft, protects the batter’s box as though it’s his property and employs the “Soto shuffle” — pawing the dirt, licking his lips, grabbing his crotch — to intimidate opposing pitchers. The young Dominican’s bat has defined him since his graceful swing and knack for barreling balls caught the attention of international scouts. It’s why the Nationals gave him a $1.5 million signing bonus at 16. It’s why he rocketed through their minor-league system, leapfrogged Class AAA altogether and debuted in the majors last year at 19. It’s why he’ll hit cleanup in the World Series before his 21st birthday.

The slump robbed Soto of his swagger. He pressed, lost his ­patience and swung at pitches out of the strike zone that he would otherwise let go. Long thought the problem might be linked to Soto’s September slump (16 for his last 78, .206). It might, at its root, go back to his first six weeks of the season because, when the young hitter fell out of rhythm, he suffered those other, smaller breakdowns.

One thing stuck out to Long: Pitchers were attacking Soto with a ton of breaking balls. He struggled most against sliders: His .621 on-base-plus-slugging percentage is 300 points lower than his ­second-worst pitch. Soto showed an ability to adjust — he homered off a slider in Game 5 of the NLDS — but their movement wasn’t the most dangerous part. Soto saw so many breaking pitches he started expecting them, and that recalibrated his timing from what Long saw as the ideal. The coach wants hitters to sit fastball, so they can catch a 100-mph pitch and react to everything else.

Long set up seven baseballs in a diagonal line toward Soto at the plate. The seventh was farthest from him; the first was almost across the plate to the catcher’s mitt. Long wanted to counteract Soto’s distorted timing by heightening his awareness of where he made contact. That would recondition his body to read, react and get the bat barrel where it needed to be against different types of pitches.

On each pitch, Long told Soto, call out the number — one to seven — where you contact the ball.

“Three!” Soto called out on the first pitch, a fastball.

“No, that was a one,” Long remembered explaining.

Soto was shocked. The ball got deeper than he realized because he prepared for a breaking ball. Long emphasized gearing up earlier than he thought necessary, and he asked Soto to try for contact at three or four. Long has always considered bat control one of Soto’s strengths, and he watched as he made the “easy adjustment” within pitches. Soto started smacking balls back up the chute, and Long remembered Soto’s instant reaction.

“Oh, my God. There it is.”

The whole thing took no longer than 20 minutes, but when Soto left the cage, he felt renewed confidence. Long grinned and told him to sleep well. They needed to sweep the Cardinals.

That night, in the first inning of Game 4, Soto stayed on a low-and-away sinker and instead of rolling over it, he flipped it down the left field line for a double. He kept the line moving on what became a seven-run first, and after he scored, raced over to Long in the dugout and told him the swing felt “really, really good.” He later smoked two more fastballs and, though they were caught, the solid contact encouraged him.

The biggest boost came in the seventh, when the Cardinals’ big left-hander, Andrew Miller, threw him a slider down and in. It was a pitch Soto probably would’ve managed weak contact against before. This time, though, he channeled everything he had learned hours ago in the cage. He reacted to the slider, backed up his contact point and barreled it. He drilled the ball into right field for a single. Long saw what anyone else paying attention did, a warning sign for all the pitchers to come. Juan Soto felt he was back.

More on the Nationals: