New York Mets starting pitcher Matt Harvey delivers a pitch...

New York Mets starting pitcher Matt Harvey delivers a pitch against the Chicago White Sox during the first inning at Citi Field on Monday, May 30, 2016. Credit: Kathleen Malone-Van Dyke

After six near-perfect innings of one-hit pitching while facing the minimum number of White Sox batters, Matt Harvey admitted Monday that the demons in his head acted up when he walked Adam Eaton and allowed a single by Jose Abreu to start the seventh.

“Obviously, when it’s 0-0 and you have a couple runners on, you kind of think about the worst at that point,” Harvey said. “Things haven’t been going that great.”

The erstwhile Dark Knight was fighting through the darkest stretch of his career. He had yielded at least five earned runs in each of his previous three starts and had failed to last beyond six innings this season. Before the game, manager Terry Collins said he might pull Harvey if he got through six innings so he could leave with a positive vibe. But when the time came, Harvey had thrown only 70 pitches, so Collins stuck with him.

“I told Dan [pitching coach Warthen], ‘If he starts the inning and they get a leadoff hitter on in the seventh, we’re going to get somebody up. But let’s see if we can get him through seven,’ and he did it,” Collins said.

Harvey not only survived that crisis to leave to a standing ovation from a Memorial Day crowd of 38,339 that chanted his name, but in the bottom of the seventh, Neil Walker’s home run to left made Harvey and the Mets 1-0 winners over the White Sox at Citi Field.

“It’s a lot of emotion,” Harvey said. “It’s been a while since I’ve tried to go out there and do everything I can to hold them from scoring a ton of runs like they have been in the past . . . To go out in a one-run ballgame and be able to put up zeros was very exciting.”

When Addison Reed threw a scoreless eighth and Jeurys Familia shook off two straight bad outings to strike out two in the ninth and record his 17th save, Collins had hit the jackpot in terms of righting two key pitchers. “You entered today with a little character-building on your plate,” the manager said. “You’ve got to get two guys back in the mix and get the confidence built back up in both of them. We couldn’t have set a better stage.”

Harvey (4-7, 5.37 ERA) allowed two hits, walked one, struck out six and threw only 87 pitches. He had to be that good against Chicago starter Jose Quintana (5-5, 2.13), who gave up six hits, walked one, struck out seven and kept the Mets off the scoreboard until Walker led off the seventh by lifting a 1-and-0 pitch barely over the wall in left-center.

“You feel happy you were able to give your team the lead, especially given the way Matt threw the ball,” Walker said. “He deserved to win.”

Harvey recently had taken to throwing side sessions with Warthen observing in a desperate search to find the solution. “A lot of it had to do with timing and staying over the rubber a little bit longer,” Harvey said. “That would free up my arm to get to the arm slot that I needed.”

The mental aspect of dealing with his lack of success was tougher than the physical part.

“You can work so hard between starts to try and figure out what’s going on, and start after start, it was still not feeling that great,” Harvey said. “I think this is a big first step of feeling a lot more comfortable.”

The crucible came in the seventh. Melky Cabrera’s sacrifice bunt moved runners to second and third with one out and brought up cleanup hitter Todd Frazier. Harvey got Frazier to foul out to first on a 93-mph fastball and induced a groundout from J.B. Shuck on a 95-mph fastball.

Speaking of Frazier, Harvey said, “He’s a dangerous hitter, and you start getting some negative thoughts that creep in your head. That was a huge out for me.”

The victory relieved a ton of pressure on Harvey, who had refused to speak with reporters after his most recent loss in Washington.

“I was frustrated with myself, and I know that’s not right and not acceptable,” a humbled Harvey said. “I let my emotions get the best of me.”

Knight Life

Yesterday’s start was Matt Harvey’s longest of the season and a vast improvement over his first 10 efforts:

Innings 7

Hits 2

Runs 0

Strikeouts 6

Walks 1

Pitches/Strikes 87/61