MINNEAPOLIS — Luis Severino loaded the bases with no one out in the bottom of the second and had two on with two out in the third.

Both times, he got out of it without allowing a run — and both times, the right-hander let out a scream as he walked off the mound.

“I thought about what happened in 2017,’’ Severino said after the Yankees’ ALDS-clinching 5-1 win over the Twins at Target Field. “In my mind. I wasn’t gonna let that happen again. … I think I got my revenge right there for what happened ’17.”

It was a far cry from Severino’s previous postseason outing against the Twins, when he retired just one batter and allowed three runs in the 2017 wild-card game in The Bronx.

Didi Gregorius bailed him out in the bottom of the inning in that game with a three-run homer that propelled the Yankees to victory.

And last year, after pitching four scoreless innings in the wild-card win over Oakland, Severino was knocked around for six runs and knocked out before recording an out in the fourth in a Game 3 loss to the Red Sox in the ALDS.

This time, Severino pitched around four hits and a pair of walks in an 83-pitch outing.

“He wasn’t his best, but he battled,’’ general manager Brian Cashman said. “Especially when his back was against the wall. He had traffic every inning, but when he had to, he made the pitches.’’

And while Severino might not have put all of playoff woes behind him, his gritty performance to help the Yankees close out the Twins showed what the right-hander is capable of in October.

Severino got into trouble in the second with a leadoff double by Eddie Rosario, a walk to Mitch Garver and a single by Luis Arraez, but he responded by getting Miguel Sano to pop to first, then struck out Marwin Gonzalez and got Jake Cave looking at a slider to end the threat and preserve the Yankees’ one-run lead.

He allowed two more singles in the third and with two out, fell behind Garver 3-0 before coming back to strike him out on a 98 mph four-seamer.

“He was able to get huge strikeouts,’’ Giancarlo Stanton said. “He was able to find a way. Those are game-changing moments. You can say he didn’t have his best stuff, but it’s what he’s got right now.”