Anthony Rendon (6) celebrates with second baseman Daniel Murphy after hitting a second-inning three-run home run against the New York Mets on Monday night. (Tommy Gilligan/USA Today Sports)

As Mat Latos was rounding first base, having homered for the first time since 2012, Max Scherzer and Gio Gonzalez bounced gleefully in the Washington Nationals dugout. In the bullpen, Blake Treinen beamed as other relievers raised their arms in celebration. Latos, meanwhile, put his head down and jogged.

With one out in the fifth, having allowed one run in 4⅓ promising innings, Latos put his head down and limped off the mound. His second-chance story succumbed to hamstring tightness and cramping, but not before an endearing effort that sent the Nationals to an 8-1 win over the New York Mets. Thanks to his homer, and a three-run shot from Anthony Rendon, the Nationals’ magic number to clinch a spot in the postseason is down to nine.

“I felt great. Felt like I had good command of the off-speed pitches and good fastball,” said Latos, who indicated he is day-to-day with the hamstring trouble. “. . . Would have liked to have gone a couple more innings for the bullpen. It’s unfortunate that it happened.”

Latos has not always been the kind of player that left teammates smiling in support, or the kind to inspire sympathy in the wake of misfortune like Monday’s injury. But after that home run, which did not surprise Dusty Baker, his former and current manager, the Nationals felt both.

“I just told [Daniel] Murphy, [Latos is] a good hitter, he might hit one out of here,” Baker said. “And when he does, he’s going to do a lot of talking. . . . After he hit it, Murph said, ‘Let him talk.’ ”

Latos was a petulant prodigy when he came up with the Padres, a kid Baker admits he had to kick in the rear now and then as he emerged as a front-line starter with the Reds.

But since the Nationals made him a September call-up, a chance they felt he earned after spending two months recommitting to his fitness, Latos has been jovial, not jaunty. As much as a 6-foot-5 man with bright blond hair and tattoos depicting Family Guy characters can escape notice, he has done so.

“I’m extremely grateful for . . . them giving me the chance and putting me down in Viera [Fla.] and putting a program together,” Latos said. “Just getting the chance of them adding me to the roster, bullpen or not. That’s the one thing I told them: I’m prepared to do whatever I need to do, whether it’s multiple innings, start, left-handed specialist, whatever it is, I’ll do whatever I have to do.”

The Nationals were searching for someone to fill Stephen Strasburg’s spot in the rotation, and they chose Latos over rookies Reynaldo Lopez and Lucas Giolito. Neither prospect had fared well against the Mets, and the Nationals want to see what Lopez can do out of the bullpen. He made his debut as a reliever after Latos left Monday’s game and threw three scoreless innings.

But before Latos called his manager, pitching coach and trainer Paul Lessard to the mound in the fifth, he looked strong. He allowed one run on three hits with three walks and four strikeouts and displayed the ability to get out of trouble. His fastball, not as fast as it used to be, settled around 92 mph. His splitter and slider did enough to keep the Mets off that fastball. He did not dominate, but he did not look out of place.

Meanwhile, Latos’s home run, which led off the second inning, triggered an offensive outburst.

Murphy doubled, his second hit in two innings. He has a hit in all 17 games he has played against the Mets. Rendon, who struck out with the bases loaded in the first, hit a three-run homer as the Nationals knocked Rafael Montero from the game in the second. They led 8-1 when Latos left the game, two outs away from his first Nationals win.

Latos is one of several of Baker’s former players to get a shot with these Nationals. Some, like Matt Belisle and Chris Heisey, turned a spring training chance into season-long roster spots. Baker said he wanted the Nationals to pursue Latos last winter, when he ended up signing a one-year deal with the White Sox instead.

When the Nationals played the White Sox in June, Baker made plans to meet Latos’s young son, Landon, for the first time. The day Baker was to meet him, shortly after Latos allowed six earned runs to the Nationals in 4⅓ innings, the White Sox designated the 28-year-old for assignment. He signed a minor league deal with the Nationals a few weeks later.

“I’ve told him it’s a chance to re-establish his value,” Baker said, “get back on the board as a big league pitcher and try to find a home and not go from team to team to team. . . . He can pitch. Just a matter of him concentrating, which he did [Monday].”

Even with Strasburg’s status in question, Latos seems unlikely to get a postseason chance like that, even if the “abuse” he joked he will get from the medical staff Tuesday clears up his hamstring trouble. But for nearly five innings, and for nearly two weeks now, he has acted like a man grateful for any chance at all. After their fourth straight win, the seventh in their past eight games, the Nationals are no worse for giving it to him.