SAN DIEGO - Jacob deGrom had absolutely no idea that he had no-hit stuff, let alone perfect game stuff.

But deGrom did Monday night, carrying a perfect game into the sixth before allowing two hits over eight innings in the New York Mets' 7-0 win over the San Diego Padres.

DeGrom (6-4) fanned the first four batters and did not allow a baserunner until Clint Barmes led off the sixth with single through the right side of the infield.

"Honestly, when I was warming up (in the bullpen), I wasn't throwing the ball where I wanted at all," deGrom said. "So I said, 'Oh no, I better get it under control when I get out there on the mound.' I was focused and able to make pitches."

After the second or third inning, deGrom said, "I knew I could make pitches and able to make them on both sides of the plate."

After Barmes reached in the fifth, deGrom struck out rookie Austin Hedges and induced pinch-hitter Abraham Almonte to hit a grounder back to the mound. DeGrom started an inning-ending double play to shortstop Wilmer Flores.

"This probably was one of the best games I've seen him pitch," Mets manager Terry Collins said. "His command tonight, changing speeds, he was really good."

DeGrom's gem came on the three-year anniversary of Johan Santana's no-hitter, the Mets' first after 8,019 regular-season games.

Will Middlebrooks had the Padres' other hit — an infield single in the eighth — before Sean Gilmartin pitched the ninth to finish the two-hitter. DeGrom faced one batter over the minimum for eight innings.

"He's pitching with a lot of confidence, a lot of momentum tonight," Padres manager Bud Black said. "He was rolling, he was on."

DeGrom and Padres starter Andrew Cashner (2-8) combined to strike out eight straight batters from the last out in the top of the first through the first batter in the bottom of the second.

Daniel Murphy had four hits, including a two-run homer, and drove in three runs as the Mets snapped a seven-game road losing streak.

Ruben Tejada had three hits and scored twice. Darrell Ceciliani, Juan Lagares and Wilmer Flores each had an RBI single as New York amassed 13 hits.

Murphy hit his homer off Cashner in a four-run fifth inning.

DeGrom, who pitched into the eighth inning in three straight starts for the first time in his career, has allowed only three runs and struck out 34 over his last 29 1-3 innings while issuing one walk.

Cashner established a couple of career highs as he struck out 12 but also gave up 11 hits. The right-hander allowed six runs — five earned — over 4 2-3 innings.

CURING HIS ROAD WOES

DeGrom's win was his first on the road this season. He was 0-3 with 6.75 ERA in three previous road starts.

PETCO PARK WOES

Mets: Monday night's win was a departure after having gone 13-24 at Petco Park, the worst record of any NL club, since the downtown ballpark opened in 2004.

Padres: The club's struggles at home continue as they drop to 13-15 for the season, and have lost eight of 11 at Petco.

TRAINER'S ROOM

Mets: Mets 1B Lucas Duda was out of the starting lineup after getting hit by a pitch in his right knee on Sunday. The team doesn't expect Duda to miss any extended time. ... The club is hoping to get an update, as early as Tuesday, on the progress of 3B David Wright (spinal stenosis). Wright has been receiving treatment in Los Angeles. ... Collins said there is no time table for C Travis d'Arnaud's return from a wrist injury.

Padres: 1B Yonder Alonso (right shoulder bruise) is expected to be activated off the 15-day DL on Tuesday, Black said. . CF Wil Myers (left wrist tendinitis) did some sliding drills Tuesday and could take batting practice on Wednesday.

UP NEXT

Mets: RHP Noah Syndergaard saw his ERA drop more than one-half a run from 2.55 to 1.82 courtesy of a scoring change. Pittsburgh's Gregory Polanco was originally awarded a single on May 22 in the second inning when two runs scored. Major League Baseball changed the scoring decision to an error on Duda, making both runs unearned.

Padres: Ian Kennedy (2-5, 7.15 ERA) has lost four straight starts, allowing 20 runs on 24 hits over 19 1-3 innings for a 9.31 ERA.