DETROIT — The Mets finally found a way around their season-long problem of hitting with runners in scoring position.

Just don’t put any runners in scoring position.

The Mets had zero such at-bats Sunday against the Tigers at Comerica Park, but it didn’t matter. Neil Walker delivered a tiebreaking two-run home run off Francisco Rod riguez in the top of the ninth and Michael Conforto hit a solo homer to power the Mets to a badly needed 3-1 victory.

The Mets, who went 2-for-17 with RISP in dropping the first two games here, salvaged the finale behind 6 2⁄3 innings of one-run ball from Jacob deGrom.

“We’ve got to start a streak and we’ve got to start someplace,” manager Terry Collins said. “We’ll take it . . . We were happy to come away with one.”

The Mets have not won consecutive games since July 6-7, but they’re still in the thick of the National League wild-card race.

advertisement | advertise on newsday

“That’s what we talk about every day,” Collins said. “ ‘Hey, look, guys, OK, we’ve got a lot of guys hurt. Big deal . . . Alls we’ve got to do is get it going. It doesn’t really matter where you finish if you finish and you get in there.”

The game was scoreless into the seventh as deGrom battled Tigers starter Anibal Sanchez, who came in with a 6.26 ERA. The Mets had only three singles when Conforto hit a two-out solo blast, his 11th homer.

The Tigers tied it in the seventh on Ian Kinsler’s bases-loaded infield single. It was the second of two consecutive infield singles to bedevil the seemingly snakebit Mets, who lost by a run Saturday night on a game-ending play at the plate.

The Mets did get a break when a baserunning blunder stopped the Tigers from taking the lead against eventual winning pitcher Addison Reed (3-2) in the eighth. Detroit had runners on first and second with two outs when Casey McGehee sent a grounder that glanced off James Loney’s glove, trickled past Walker and went into short rightfield for a single.

But J.D. Martinez, who was on second, did not try to score and stopped at third. Justin Upton, who was on first, continued on toward third. Martinez was tagged out after a brief rundown as Curtis Granderson realized what was happening and ran almost all the way to the infield before throwing home.

Mets videos

“My first thought was, ‘Not again. You’ve got to be kidding me,’ ” Collins said. “ . . . A stinkin’ 14-hopper that gets off somebody’s glove. I said, ‘C’mon.’ Fortunately, we caught a break.”

In the ninth, Rodriguez (1-2) hit Alejandro De Aza on the hand with an 0-and-2 pitch before Walker homered to right-center, his 19th of the season.

Jeurys Familia struck out the side in the ninth around a two-out single for his 39th save.

After the game, Walker drove to Pittsburgh to be with his pregnant wife, who is due next week. He will return Tuesday when the Mets host Arizona with a new optimism about their postseason chances.

“We’re grinding,” Walker said. “The guys aren’t really worried about what the numbers say. They’re not getting down. They’re focusing on scoring at least one more run than the other team at the end of the day.”