Winning has been anything but routine for a Yankees team that has struggled to keep its head above water all season. But when they get a quality start like the one Masahiro Tanaka delivered against the Twins on Friday night at Yankee Stadium coupled with a dash of timely hitting, the formula for victory falls neatly into place.

The final variable, of course, is the Murderers’ Row in the bullpen — Dellin Betances, Andrew Miller and Aroldis Chapman — who combined to throw three perfect innings to wrap up a 5-3 win over the Twins. Chapman struck out the side in the ninth in earning his 14th save, throwing 11 strikes in 11 pitches and topping out at 104 mph on the radar gun as the Yankees regained the .500 level at 36-36.

It all began with Tanaka (5-2), who allowed three runs, seven hits and two walks but struck out seven to tie his season high. He left with a 4-3 lead, and Aaron Hicks added a solo homer in the eighth.

Tanaka said he always wants to go at least seven innings, but with his pitch count mounting and given the lineup coming behind him, he said, “You say to yourself, just get through the sixth tonight.”

The starter was as impressed with the bullpen as the crowd of 44,808 that oohed and aahed as Chapman lit up the radar gun, twice reaching 104 mph, according to MLB.com. “I was watching on TV,” Tanaka said. “Outstanding is the only word I can think of. It felt [Chapman was throwing] faster than usual.”

Tanaka had the benefit of an extended rest of six days, which often gives him a boost because that’s how he was used in Japan.

advertisement | advertise on newsday

Trouble developed in the third inning when he yielded leadoff singles to Kurt Suzuki and Byron Buxton, the Nos. 8 and 9 hitters in the Twins’ lineup. Former Yankee Eduardo Nuñez seized the moment to inflict pain on his old team by drilling a two-run single to centerfield. But despite walking Joe Mauer, Tanaka managed to escape without further damage by striking out Brian Dozier and Max Kepler.

Twins starter Tommy Milone was undone by two errors in the bottom of the third as the Yankees tied the score at 2.

Austin Romine reached first on an error by Eduardo Escobar before being forced at second on a grounder by Brett Gardner. With two outs, Carlos Beltran ripped an RBI double into the leftfield corner and scored on Alex Rod riguez’s single to left as the throw home was wild.

In the top of the fourth, Suzuki’s one-out double put runners on second and third and Buxton’s grounder gave the Twins a 3-2 lead. But in the bottom of the inning, the Yankees loaded the bases with none out on a walk to Chase Headley, a bunt single by Didi Gregorius and an error by first baseman Mauer on Hicks’ grounder. Austin Romine tied the score with a sacrifice fly and Rob Ref snyder’s two-out single gave the Yankees a 4-3 lead.

Given some run support, Tanaka was as tenacious as usual, but the bullpen absolutely dazzled. Betances loved it when Chapman blitzed Suzuki with pitches of 103, 103, 104 and 104 before getting the final out on a 91-mph changeup. “He’s an animal,” Betances said.

Yankees videos

Chapman admitted he sometimes peeks at the scoreboard to see how fast he’s throwing, and his awareness of the crowd reaction fired him up. “I can feel the fans,” he said. “I can feel the energy. It’s something you can see and feel.”

Well, you could see the reaction, but no one could see Chapman’s blinding fastball.