– All it takes is one good week, and a team’s playoff hopes can drastically change.

The Twins are a shining example of that. A week ago appeared to be the beginning of the end for them when they were swept in New York and faced series against wild-card hopefuls Baltimore and Tampa Bay. One week — and a season-high six consecutive victories later, all on the road — the Twins have fully rebounded.

They cobbled together a 5-3 victory over the Rays on Wednesday. With the Angles and Rangers both losing, the Twins are back in the second wild-card spot in the American League.

“The thing I’m proud of is the way we bounced back from the Yankees series,” second baseman Brian Dozier said. “That was a tough go there for three games.

“We’ve had a bunch of guys step up. I feel like every night it’s a different guy.”

When a team is living large like the Twins are, a bunch of people usually are involved.

All six victories have come during this road trip, the Twins’ longest road winning streak since August 2007.

Eduardo Escobar hit two solo home runs. Joe Mauer was 3-for-5 with an RBI. The bullpen gave up one earned run over the final 3 ⅔ innings. And Kevin Jepsen picked up his third save as a Twin with closer Glen Perkins sidelined because of back spasms the past couple of days.

Perkins began having problems with his back while warming up Sunday in Baltimore but pitched through it. He hopes to be back soon.

“We’ve won six in a row now, and I have had to sit and watch five of them,” Perkins said. “I’m happy the guys are getting it done.”

With the score tied at 2-2 in the seventh, Shane Robinson led off with a walk. Byron Buxton laid down a sacrifice bunt and used his blazing speed to beat it out for a hit.

Dozier got the bunt sign twice, misread it once, then squared up to bunt a high slider and popped it up. But Rays righthander Chris Archer (10-11) couldn’t come up with it, diving for the ball just over his head and out of his reach. Dozier was safe — and relieved.

“It was a complete turn of emotions,” Dozier said of his first sacrifice bunt attempt of the season. “I knew the slider was coming. I should have taken it.”

With the bases loaded, Mauer hit a broken-bat blooper to center for an RBI single off reliever Xavier Cedeno to make it 3-2. Trevor Plouffe added a sacrifice fly to put the Twins ahead 4-2.

Evan Longoria led off the bottom of the seventh with a home run to get Tampa Bay within 4-3. Escobar hit his second solo home of the game in the eighth to put the Twins up 5-3.

Twins righthander Tyler Duffey gave up two runs over 5 ⅓ innings on a night his fastball command was a little off and he needed a few innings to find his good curveball. He gave up runs in the fourth and fifth innings but left the bases loaded in both of them. Brian Duensing (4-0) replaced him with one out in the sixth — and the bases loaded — and got out of the jam.

Tampa Bay ended up 2-for-11 with runners in scoring position.

“I was glad Duff went as far as he did and we were able to scratch out the rest of the outs,” Twins manager Paul Molitor said. “Duensing got two big outs to get out of the inning.”