Four games this week separated by a total of five runs.

And the Twins took two of them from the St. Louis Cardinals, the team with the best record in baseball.

That includes a thrilling 2-1 comeback victory Thursday at Target Field when Joe Mauer homered in the eighth and Kennys Vargas blasted a walk-off winner in the ninth off Carlos Villanueva that led to a roar that would have torn the roof off the stadium, if it had one.

After losing a pair of 3-2 games in St. Louis on Monday and Tuesday, the Twins beat the Cardinals in the next two in Minneapolis. And as Vargas was mobbed at home plate after his big blast — the Twins’ second walk-off victory of the season — the players hoped the victory would turn out to be a June swoon-stopper. The pitching has held up but Thursday marked the 11th time this month the Twins have scored two or fewer runs in a game. Hence, they are 6-11 in June — but want this week of battling baseball to lead to better things.

“We feel we can play with anybody on any given day. This series proved it,” Mauer said. “All four games we were in it with a chance to win. I think we know that in here.”

The Twins looked destined for a crushing loss. They were stymied by Cardinals starter Jaime Garcia into the seventh inning, and St. Louis was 34-0 this season when leading after seven. Mike Pelfrey looked to be a tough-luck loser because his 3-1 fastball in the seventh was blasted into the seats by Jason Heyward for the first run of the game.

The Twins tried to rally in the seventh when Torii Hunter led off with a walk and Eddie Rosario beat out an infield hit — a play originally ruled an out before manager Paul Molitor successfully challenged.

Righthander Seth Maness, a ground-ball inducing machine, replaced Garcia, and Eduardo Nunez bunted the runners to second and third. Maness then walked Kurt Suzuki intentionally to get to Vargas.

Vargas, who stopped an 0-for-16 skid earlier in the game, bounced into an inning-ending double play.

But the Twins fans among the announced crowd of 34,648 — the Cardinals faithful travel really well — came to life in the eighth.

Cardinals lefthander Kevin Siegrist entered the game and struck out Byron Buxton at the end of a nine-pitch at bat. Brian Dozier also went down swinging. Mauer stepped to the plate with his batting average an unfathomable .250. But on a 3-2 pitch, Mauer blasted a 403-foot homer into the seats in left to tie the score.

“You try to stick with it and stay positive,” said Mauer, who has three home runs this season. “When you get in those situations, you might overadjust, and I’ve caught myself doing that over the last couple of weeks. You just keep working and stay positive.”

The Cardinals threatened in the top of the ninth when Matt Carpenter led off with a double off reliever Blaine Boyer and moved to third on Jhonny Peralta’s groundout. Boyer struck out Mark Reynolds with a slider, then got Yadier Molina to fly out to end the inning.

With two outs in the ninth, Vargas got a 1-1 curveball from Villanueva and pulled it into the seats in right. He raised his right index finger to the air as the Twins dugout emptied.

“For Kennys to win the game,” Molitor said, “the goat-to-hero couldn’t have been any more appropriate in that scenario.”

They will find out this weekend in a three-game series against the Cubs what the two victories over the Cardinals did for them.

“Hopefully,” Pelfrey said, “this will get us going.”