Disarray marked every corner of the operation, from the handling of injuries to the handling of ground balls. For much of the season’s opening month, the Mets did little right.

Even their starting pitching, the supercharged engine that would drive them to October, had broken down and sputtered. For a team with aspirations, the timing was inconvenient.

But the Mets have shown the capacity to weather their own internal strife, beating the Giants, 6-1, on Tuesday night to reach the .500 mark for the first time since April 20.

“To get to the end goal, you’ve got to get back to .500,” said manager Terry Collins, who used his top relievers despite a five-run lead.

Zack Wheeler allowed one run and two hits in six innings, Neil Walker tripled and knocked in two runs and Michael Conforto hit his eighth homer of the season. The Mets (16-16) won for the fifth in their last six games and clinched a win in their fourth-straight series.

Adversity has done little to interrupt the Mets. The lineup is still missing Yoenis Cespedes and the rotation is without Noah Syndergaard. And before Tuesday night’s game, the Mets went through another slice of drama with Matt Harvey’s clubhouse apology for skipping Saturday’s game after partying too hard the night before.

advertisement | advertise on newsday

But the Mets left that distraction in the clubhouse, continuing their improbable surge after a tailspin in which they had dropped 10 of 11 games. The damage was severe, knocking the Mets to five games below the .500 mark by April 27.

Since then? They’ve won eight of their 11 games, with a chance to finish off a three-game sweep on Wednesday, with recently acquired lefty Tommy Milone set to make his Mets debut.

Fast starts have been a speciality for the Mets, and on Tuesday night, the Giants’ Jeff Samardzija fell victim. The Mets opened a 4-0 lead after the first inning. It was the eighth time in their last nine games they have scored in the first inning for a total of 17 runs.

“There’s been a lot of action around here,” Collins said. “And to jump out to a big start like that, it let everyone breathe.”

Walker got the Mets going in the first with an assist from Giants fill-in leftfielder Eduardo Nunez. One night after a walk-off single in the bottom of the ninth, Walker hit a sinking liner to left with a pair of runners on. Nunez misplayed it, allowing the ball to get by him, giving the Mets a 2-0 lead.

Mets videos

Two batters later, Jose Reyes followed with an RBI single ahead of catcher Rene Rivera, who doubled over the head of centerfielder Gorkys Hernandez to make it 4-0. Rivera, a lifetime .218 hitter, is hitting .333 through 18 games.

“It’s knowing myself, knowing what I can do, and keeping it simple,” said Rivera, a defensive specialist who went to work on his plate approach in the offseason.

Another unexpected contributor, T.J. Rivera, tacked on another run in the second with an RBI double that scored Conforto. Once an undrafted free agent, the Mets’ fill-in first baseman went 3-for-4 to raise his average to. 309. Even Collins admitted it might be tough to get Rivera out of the lineup once Lucas Duda returns.

“You can either let it affect you or come together as a team,” Rivera said of battling the turmoil. “We want to just keep rolling.”

But it was on the mound where the Mets may have received their biggest boost. The only damage off Wheeler came on Buster Posey’s solo shot to left in the fourth. For the first time since April 18, a stretch of 17 consecutive games, a Mets starter allowed one run or fewer.

advertisement | advertise on newsday

“I felt the best I have all season,” said Wheeler, who benefited from a mechanical adjustment he worked on between starts.