The Twins won the game Friday night. Though it might be more appropriate to say Toronto lost it.

After squandering an early five-run lead, the Twins came back for a walkoff 6-5 victory in the 10th inning, engineered mostly from a costly Blue Jays mistake.

Some would call that fluky or lucky. Rocco Baldelli prefers to explain it as baseball.

"When you start with the runner on second base, anything can happen," the Twins manager said. "We know that. You just got to give yourself a chance. You've got to put the ball in play. You've got to make the other team make plays sometimes.

"It's not going to always be the ball that's barreled up and goes in the stands. It doesn't have to be, sometimes, even the greatest at-bat that you've ever had."

And that it was not. Jake Cave actually struck out on a ball in the dirt but reached first base when Toronto catcher Danny Jansen botched the throw to first, throwing it over the head of Vladimir Guerrero Jr. That also gave Nick Gordon — the runner who had started extra innings on second base — a chance to scamper to third.

Tim Beckham put the ball in play on the next at-bat, grounding the ball to third, but speedy Gordon beat Jansen's tag at home for the winning run, flailing his arms for the safe call while still stretched out on his belly.

"I actually was sliding and watching the catcher, so I was actually seeing the ball fall, and I was kind of yelling at the umpire. I was like, 'Safe! Safe!' " Gordon said. "So I was hoping he heard me."

The victory came in front of an announced 29,593 fans — a good chunk of them rooting for Toronto — at Target Field, and it gave the Twins (56-50) a two-game lead in the AL Central over both Cleveland and the Chicago White Sox. Toronto dropped to 59-47, still in second in the AL East.

The Twins had a runner on base with a chance to extend or take the lead in the seventh, eighth and ninth innings. But it took until the 10th — and the second Blue Jays error — to finally come through after stranding 11 on base and going 3-for-15 with runners in scoring position.

The bottom of the ninth, for example, had Gio Urshela — out of the starting lineup with a foot/ankle injury he picked up in Thursday's game — delivered a pinch hit single leading off the inning. Gilberto Celestino then pinch ran for him and performed some acrobatics to avoid running into a Luis Arraez groundout on his way to second. Carlos Correa benefited from second baseman Cavan Biggio bobbling the ball to put runners on first and third.

Reliever Yimi Garcia intentionally walked Jorge Polanco to load the bases and struck out Jose Miranda. Gordon then flew out to force extra innings.

Beckham said while he was at the plate in the 10th — with Gordon on third and Cave at second after advancing on defensive indifference — all he was thinking was find a pitch in the zone, hit it anywhere, something good is bound to happen.

"Once I heard the crowd screaming, I looked back like, 'Oh, what do we got?' " Beckham said of when he knew the Twins had won as he ran to first. "Baseball's crazy. We'll take the win any way we can and keep it rolling."

Beckham also added the game was "interesting," which is one way to put it.

The Twins forced their former ace Jose Berrios from the game after only 3⅔ innings after he gave up home run to Mark Contreras, a RBI single to Miranda and a three-run homer to Gordon.

With a five-run lead, Twins starter Tyler Mahle — making his first appearance after his trade from Cincinnati — gave up just one hit through four innings but surrendered four hits and four runs in his final two. All of the runs came of home runs, solo shots for Matt Chapman and Santiago Espinal, plus a two-run bomb from Guerrero that made it 5-4.

The Twins bullpen — which had a terrible night in the first game of the series Thursday that led to the team designating longtime pitcher Tyler Duffey for assignment — had its own swings, albeit emotional ones.

Griffin Jax struck out the side in his seventh inning. Jhoan Duran put away his first two batters but then had to pitch around a pair of singles to the top of the Toronto order in the eighth. Jorge Lopez was a strike away from ending the game in the ninth when Raimel Tapia smacked a tying RBI single, the Blue Jays' third single of the inning.

Michael Fulmer struck out Whit Merrifield to start the 10th, but then had the bases loaded from a walk and a hit, plus the free runner. But he returned to strikeout form, retiring Teoscar Hernandez and Bo Bichette to give the Twins another chance at the eventual walkoff.

"Anything can happen in this game if you give yourself the opportunity," Baldelli said. "And we did that. And it just happened. It just worked out. We'll take that all day."