HOUSTON (AP) — Almost out of contention in May, champs in October.

Howie Kendrick, Anthony Rendon and the Washington Nationals completed their amazing comeback journey — fittingly with one last late rally on the road.

In Game 7 of the World Series, no less.

Kendrick and Rendon homered in the seventh inning as the Nationals overcame a two-run deficit, rocking the Houston Astros 6-2 Wednesday night to win the first title in franchise history.

With all eyes on Max Scherzer and his remarkable recovery after a painkilling injection, these Nationals truly embraced their shot in the only Series when the road team won every game.

Even more against the odds: Juan Soto and Washington came from behind to win five elimination games this postseason, an unprecedented feat.

“What a story,” said Ryan Zimmerman, the Nationals’ initial draft pick back in 2005.

“I hope D.C.’s ready for us to come home!”

World Series MVP Stephen Strasburg, new lefty Patrick Corbin and the Nats brought the first World Series championship to the nation’s capital since ol’ Walter Johnson delivered the crown for the Senators in 1924.

This franchise started out as the Montreal Expos in 1969 when the major leagues expanded beyond the border, putting a team with tricolor caps at jaunty Jarry Park. They moved to D.C. in 2005, ending Washington’s three-decade-plus wait for big league baseball after the Senators left town to become the Texas Rangers.

But the incredible path these wild-card Nationals with the curly W logo took, well, no one could have imagined.

“Resilient, relentless bunch of guys,” manager Dave Martinez said. “They fought all year long.”

Having lost star slugger Bryce Harper to free agency and beset by bullpen woes, Washington plummeted to 19-31 in late May. It got so bad there was talk around town the Nationals might fire Martinez and trade away Scherzer.

Instead, they stuck with the mantra that sprung up on T-shirts — Stay In The Fight.

“That was out motto,” Scherzer said.

And months later they finished it, indeed.

“Guess what? We stayed in the fight. We won the fight!” Martinez shouted during the trophy celebration on the field.

“We were down and out. We were 19-31. We didn’t quit then, we weren’t going to quit now,” he said.

For the 43,326 revved-up fans at Minute Maid Park, it was a combination of shock and disappointment. So close to seeing the Astros win their second title in three years, they watched their chance suddenly vanish as Houston fell apart.

“I’ve got a group of heartbroken men in there that did everything they could to try to bring a World Series championship to this city. And we fell one win shy,” Astros manager AJ Hinch said.

“Let’s be honest, there’s 28 other teams that would love to have our misery today. We play to get here. We play to have an opportunity to win it all. And I just told our team, it’s hard to put into words and remember all the good that happened because right now we feel as bad as you can possibly feel,” he added.

Washington kept pulling away after taking the lead, with Adam Eaton’s two-run single in the ninth accounting for the final margin.

Zack Greinke was in complete control until Rendon — a Houston prep and college star — hit a home run that cut Houston’s lead to 2-1 in the seventh.

When Soto followed with a one-out walk, manager AJ Hinch decided to make a move. He’d had ace starter Gerrit Cole warming up in the bullpen earlier, but this call was for Will Harris.

Kendrick connected on the second pitch, slicing a drive that hit the screen attached to the right field foul pole. Just like that, everything had changed for the team in orange that led the majors in wins, and the ballpark fell silent.

For Kendrick, another timely blow. At 36, playing on the oldest team in the majors, the journeyman earned the NL Championship Series MVP award against St. Louis after hitting the winning grand slam in the 10th inning of the deciding Game 5 in the Division Series at Dodger Stadium.

Then again, this was nothing new for the Nationals.

Washington rallied in the eighth to beat Milwaukee in the wild-card game and took the last two to beat Los Angeles in the NLDS, setting up a sweep of the Cardinals in the NLCS.

Far away, a big crowd poured into Nationals Park for a watch party. That was the stadium where Houston hammered the Nats for three games last weekend, but their luck changed in Texas.

“The way this game went is the way our whole season went,” said Zimmerman, the last player left from the 2005 Nationals team that debuted in Washington.

This World Series had lacked a lot of drama, aside from a volatile call of interference in Washington’s Game 6 win that stoked heated debate across the sports world. Who knew rule 5.09(a)(11) could stir such passion?

With Greinke and Scherzer grunting on every pitch, Game 7 was a classic duel from the start.

Yuli Gurriel put the Astros ahead with a home run in the second and Carlos Correa added an RBI single off Scherzer that made it 2-0 in the fifth.

Scherzer was done after the fifth, but he had done his job to keep it close. Only a few days earlier, the three-time Cy Young Award winner had been unable to lift his right arm because of nerve irritation near his neck.

Daniel Hudson, released by the Angels in March, closed it out for the Nationals, who made Houston pay for stranding so many runners on base all game. Hudson struck out Michael Brantley for the last out, then threw his glove to start the celebration.

For the Astros, who brought baseball into the Space Age with their far-out Astrodome and AstroTurf, and helped zoom the game into the galaxy of the Analytics Era, it was a startling end.

Houston shares a spring training complex in Florida with the Nationals and reported to camp in February full of high hopes.

The Astros breezed to the AL West title, edged Tampa Bay in a five-game ALDS and topped the Yankees in the ALCS. They played through front-office fiasco, which led to the firing of an executive for a boorish rant at female reporters during a clubhouse celebration.

UP NEXT

The Astros and Nationals start training side-by-side in a few months and open exhibition play with a World Series rematch on Feb. 22 at Ballpark of the Palm Beaches. They met in their Grapefruit League opener this year and Scherzer gave up a home run to the first batter of the game.