PHILADELPHIA — Inactivity can be a funny thing, especially in an endeavor as reliant on rhythm and routine as baseball. Pauses in the schedule, even ones as welcome as the Midsummer Classic, can wreck timing.

“You never know what the first game after the All-Star break is going to be like,” Mets second baseman Neil Walker said.

Nevertheless, the Mets trudged through their first day after the All-Star break in much the same way that they soldiered on in the days leading up to it.

Manager Terry Collins took stock of which players were healthy, which were not, then watched the Mets beat the Phillies, 5-3, despite fielding a lineup compromised by injuries.

Even after a seven-day hiatus, slugger Yoenis Cespedes still felt pain in his strained right quad, forcing Collins to leave him out of the starting lineup. But the Mets (48-41) got a boost from Walker and Juan Lagares.

Walker bashed a three-run homer in the sixth off righthander Jeremy Hellickson to give the Mets a 4-0 cushion. Lagares hammered a solo homer in the third and helped manufacture a crucial run in the seventh.

“That’s the kind of player that he can be,” Collins said. “He can really run.”

It was enough to support 43-year-old Bartolo Colon. Just as he had done throughout the season’s first half, the veteran kept the Mets in the game, allowing three runs (though none were earned) in 5 2/3 innings.

“I got a little tired and that’s when things got a little complicated,” said Colon, who nonetheless improved to 8-4.

Closer Jeurys Familia made quick work of the Phillies in the ninth. Well rested after he was held out of the All-Star Game, Familia nailed down his 32nd straight save to start the season, capping a stellar night for the bullpen.

Hansel Robles, Jerry Blevins, Addison Reed and Familia combined to throw 3 1/3 scoreless innings.

Lagares gave the Mets a 1-0 lead with his third homer of the season. But the big blow came in the sixth from Walker, who lined a 3-and-2 pitch the other way for his 16th homer. With that timely swing, Walker equaled his season total from last year.

Meanwhile, Colon retired the first 13 batters he faced, needing only 15 pitches to cruise through his first two innings. But it wasn’t until the sixth that Colon looked unsteady, and even then, it was a poor throw by typically steady first baseman James Loney that set things in motion.

After making a nice play to field Odubel Herrera’s grounder, Loney’s feed to Colon at the bag sailed high and out of the pitcher’s reach.

Peter Bourjos followed with a run-scoring triple, then scored on Maikel Franco’s groundout. Two batters later, Cody Asche hit a run-scoring single into shallow leftfield, scoring Tommy Joseph and cutting the Mets’ lead to one run.

With that, Colon was chased from the game, though Robles ended the threat by getting Freddy Galvis to hit an inning-ending pop-up.

Lagares delivered an insurance run, doing it in a fashion that has been nearly foreign to the grip-it-and-rip-it Mets. He produced the tally with his legs.

Lagares worked a leadoff walk, then swiped second base. Alejandro De Aza lifted a fly ball to the warning track in right, deep enough to advance Lagares to third.

When Jose Reyes hit a grounder to Galvis at short, Lagares alertly ran on contact. He scored, even though Galvis was playing in and uncorked a throw that was good enough to make the play close.

“I know I can run a little bit,” Lagares said. “When I have a chance, I want to take advantage of it.”