Inning after inning, the Mets squirmed from danger, finding some new escape route before the Miami Marlins could dispense a definitive blow.

And at the end of a long afternoon of dodging trouble, all their evasiveness paid off. Entering the ninth inning Sunday, trailing the Marlins by a run, the Mets rallied to win, 4-3, on a two-run, game-ending single by Marlon Byrd.

The sun was setting on a chilly afternoon, and only a fraction of the announced crowd of 29,780 remained. But the stands at Citi Field became electrified when Byrd drilled a sinker from Steve Cishek down the third-base line, providing ample time for Ruben Tejada and Kirk Nieuwenhuis to scamper home.

“It’s something we can take later on, down the road, in the ninth inning,” Byrd said. “We’ll always know we’ve got a chance, because we’ve done it before.”