On Yordan Alvarez’s first at-bat of the game, he smacked a pitch from Joe Ross 405 feet into straightaway center field, a two-run home run that hit a fan in the stomach because he was holding cans of Bud Light in each hand. On Alvarez’s next appearance at the plate, the Houston Astros were down to their last out of the fourth inning, and he singled to right field to bring up shortstop Carlos Correa, who then hit a home run of his own.

And with the Astros leading the Washington Nationals by those four runs in Sunday night’s Game 5 of the World Series, his third at-bat came in the seventh. He hit a groundball to right for a single, capping a 3-for-3 night before getting replaced by Jake Marisnick, more reliable defensively with Houston protecting the lead Alvarez helped build.

“All my teammates were saying: ‘Today’s your day. Today’s your day,’ ” Alvarez said through an interpreter. “And it happened.”

The 22-year-old rookie who had been struggling at the plate this World Series rediscovered his offense just in time for the Astros, propelling them to a 7-1 win that has them just one victory away from a second title in three years. Houston has scored 19 runs in the past three games after putting up just seven in the first two.

After posting a .313 batting average, a .412 on-base percentage and a .655 slugging percentage in 87 regular season games, making him the favorite for American League rookie of the year, Alvarez struggled mightily in October, hitting .204/.278/.265 entering Sunday’s Game 5. His two-run home run in the second inning was his first since Sept. 21. In 54 plate appearances, he had struck out 21 times.

But Correa had been especially confident that Alvarez was due for a breakout, leading the chorus of Astros telling Alvarez that Sunday would be his day.

“I just told him that what great players do when they struggle is try to figure out a way to contribute to the game,” Correa said. “He went to the cage. He spent time in the cage. He put in his work. And he told me that he was feeling great. I said: ‘It’s your night, brother. Let’s go.’ And he was able to contribute in a big way. . . .

“It’s huge to see him swing the bat like that because now we go back home and then he’s our DH at 22 years old for a reason.”

The Astros didn’t learn that they would be facing the right-handed Ross instead of ace Max Scherzer, who was scratched because of spasms in his right trapezius muscle, until Nationals Manager Dave Martinez told reporters at 4:30 p.m. Houston third baseman Alex Bregman saw the news on his phone and then asked Astros Manager A.J. Hinch whether it was true. Martinez had asked Washington bench coach Chip Hale to relay the message 30 minutes earlier, which he did, but it had yet to reach Hinch.

“It immediately goes into sort of game prep mode and get after it,” Hinch said. “We were prepared for Ross as a reliever, but it’s a little bit different when you go into a game as a team offense. . . . You can’t be overly confident. You can’t just assume that it’s going to be an easy game for you. It’s a different matchup, different style.”

Indeed, the most dangerous part of the Astros’ order, from George Springer in the leadoff position to No. 5 hitter Yuli Gurriel, managed just two hits off Ross through five innings. But even before the late notice on the change in starting pitchers, Hinch had targeted Sunday’s game as one to give his lineup an offensive boost with Alvarez returning to the sixth spot after coming off the bench the previous two games.

In AL games, Alvarez is typically the Astros’ designated hitter because Hinch said he’s “limited in some ways in his range and in his experience.” With Houston ace Gerrit Cole on the mound, Hinch figured Game 5 would be a good one to start Alvarez under NL rules because he probably wouldn’t be facing much action in left field; Cole predictably struck out seven batters and allowed few balls in play during the six innings Alvarez was in the game.

“You want to talk about feeling like you did the right thing — just put Yordan in the game and have him have three incredible at-bats,” Hinch said. “He’s done this the whole year, but this postseason as he’s tried to find his way, it was nice to see him stay within himself. And then the dugout actually exploded more when he caught the line drive in left field. Everybody was having a good time with him. . . .

“He was a big catalyst tonight.”

Alvarez had a miserable AL Championship Series, when he had just one hit in 24 plate appearances — he walked twice — against the Yankees. At his lowest point, he broke a bat over his knee. Teammates tried to encourage him; third baseman Alex Bregman told Alvarez about how he and Springer played poorly during the 2017 ALCS before snapping out of it in that World Series.

“He’s always looked comfortable in the box even through his struggles,” Hinch said. “He had a little bit of frustration throughout the postseason. But when we keeps his balance and he keeps his zone control, we see the damage he can do. Obviously tonight was a good example of that.”