Yankees bats erupt for comeback win to sweep Blue Jays

BUFFALO — The Yankees staggered into Buffalo following a pair of tough losses in Philadelphia that dropped them to just a game over .500.

They left Sahlen Field winners of three straight, completing a sweep of the Blue Jays with an 8-4 victory — coming from behind again as they head back to The Bronx.

Giancarlo Stanton delivered the go-ahead homer, a two-run shot to right in the top of the seventh, and Chris Gittens added some insurance with a pinch-hit, two-run single.

“There’s only so long all of us can underperform and take this beating inside and out, not playing to our abilities,’’ Stanton said. “It was time to step up and start punching back.”

They overcame deficits in the seventh inning or later in all three victories, using key pinch-hits by Clint Frazier, Gary Sanchez and — on Thursday — Gittens, who had a two-RBI single to give the Yankees some insurance.

Gio Urshela (l.) celebrates his two-run homer against the Blue Jays with Giancarlo Stanton.

It came after Aaron Judge said before the game that he liked the fight the team displayed in the first two victories of the series.

“I think that shows what this team is made of,’’ Judge said. “This whole year, when we got down early, we’ve been pretty flat. That’s not the team we are. We’re a team that can come back [from] 5-0, 3-0. It doesn’t matter with this team.”

Judge made his impact Thursday with his glove, reaching high over the wall in right field to rob Cavan Biggio of a two-run homer in the sixth. It would have given the Blue Jays a three-run lead. Instead, it stayed a one-run game, and Stanton put them ahead the next inning.

“That was the play that changed the game,’’ Gio Urshela said.

There were a few, including a first-inning comebacker that helped Michael King escape the frame without allowing a run with runners on second and third and no one out and Vladimir Guerrero Jr. at the plate.

Guerrero’s grounder to King turned into a 1-3-6-2-5-6 triple play, as they got Marcus Semien and Bo Bichette between bases — proving the Yankees don’t have a copyright on poor baserunning. It was their second triple play of the season.

Urshela doubled and scored in the second, the first of three hits. He also homered in the third and added a terrific defensive play to end the fourth, using a cannon throw to get Lourdes Gurriel Jr.

Toronto went ahead in the sixth with Randal Grichuk’s RBI single off Chad Green before Stanton gave the Yankees the lead again an inning later with his opposite-field shot to right off Toronto’s shaky bullpen.

Sanchez and Urshela followed with singles before Gardner bunted them over and Andujar grounded out.

The Yankees then went to Gittens to hit for Tyler Wade, despite having already lost Gleyber Torres to back tightness.

The move paid off, as Gittens delivered a two-run single to right to make it 7-4, as the Yankees completed a four-run inning — all off Anthony Castro.

And they got 5 ²/₃ innings of one-run ball from their bullpen, with Zack Britton closing it out in the ninth.

“We’ve done this in years past,’’ Stanton said of the repeated rallies. “It’s what’s been expected of us. The teams we had were never out of games. We know what we’ve got in us. It’s a matter of putting it together. We have to feed off this. … One or two series ain’t gonna cut it.”

Their next test is the first-place A’s, who come to The Bronx on Friday.

“We’ve gone through some tough challenges this season,” manager Aaron Boone said. “This was a big series for us [against] a team that’s beaten us a little bit already. … To bounce back and have some gut-check wins come from behind a little bit, was good.”