Photo/Illutration San Diego Padres starting pitcher Yu Darvish works against a New York Mets batter during the first inning of a baseball game June 3 in San Diego. (AP Photo)

SAN DIEGO--Fernando Tatis Jr. returned to the lineup with a two-run homer that slipped out of center fielder Mason Williams’ glove, and the San Diego Padres held off the New York Mets 4-3 on Thursday night.

Yu Darvish (6-1) pitched effectively into the sixth inning and helped himself with two hits. Mark Melancon escaped a ninth-inning jam when Kevin Pillar grounded sharply into a game-ending double play.

Tatis also dashed home aggressively on a wild pitch as the Padres ended a four-game skid in the opener of a seven-game homestand against a pair of first-place teams.

“Tatis is talented. You see the speed, the power, the arm. He has many ways to beat you,” Mets manager Luis Rojas said. “He is a special player.”

James McCann hit a two-run homer and Billy McKinney had an RBI triple off the wall in the eighth that nearly tied it as the Mets fought back from a 4-0 deficit. New York had won six of seven.

Darvish gave up two runs and four hits in 5 1/3 innings, striking out five.

“I think the cutter was pretty good tonight,” he said through a translator. “The last two innings I felt my mechanics came together as well.”

Mets starter Taijuan Walker (4-2) lasted five innings, allowing four runs (three earned) and seven hits.

Melancon put his first two batters on but worked out of it to earn his major league-leading 18th save. The veteran closer was pitching for the first time since Saturday, when he was handed his second blown save in two days at Houston--his first two blown saves of the season.

Tatis was back in the lineup for the first time since being removed from Tuesday’s game in Chicago because of right oblique tightness. He hit a towering drive in the third after Manny Machado walked, tying for the big league lead with his 17th home run of the year.

“I kind of hit it a little bit too high. I wasn’t sure it was going to go out, but I’m glad it did,” Tatis said. “Every time we are back in San Diego it is way more viable, we have way more energy. It is awesome playing at home.”

Williams appeared to have the high fly lined up against the wall in straightaway center. He jumped and had the ball in his glove above the fence, but it popped out and went over for a 401-foot homer.

“It just came out of my glove when I impacted the wall. It’s a play I probably should have made,” Williams said. “The ball was in my glove, so I should have made it.”

San Diego added a run in the fourth after a walk to Victor Caratini and a double by Darvish put runners at second and third with one out. Jurickson Profar singled home Caratini for a 3-0 lead before Machado hit into an inning-ending double play.

The speedy Tatis scored from third on a wild pitch in the fifth that didn’t get far from McCann behind the plate.

McCann followed Francisco Lindor’s walk with a two-run homer off Darvish in the sixth. With the bases loaded and one out, reliever Tim Hill got pinch-hitter Pete Alonso to ground into a double play.

“McCann put a good swing on a two-strike pitch and it got out, but that was really about it,” Padres manager Jayce Tingler said. “(Darvish) gave us exactly what we needed.”

Lindor scored from first on McKinney’s two-out triple off Emilio Pagan in the eighth. Brandon Drury, who had a tough night on defense at third base, grounded out to end the inning.