BOSTON — The faces might have been different, but it was still a rivalry matchup at Fenway Park, where plenty of Yankees closers have crumbled before.

After stumbling Wednesday for the first time this season, Aroldis Chapman recovered to pick up another save — not without drama in a 3-1 win over Boston.

“He’s not going to be perfect every time,” Austin Romine said of Chapman, who picked up his fifth save in as many chances this season.

But not before Josh Rutledge put a brief scare into the Yankees.

“It was a night I was not expecting,’’ Chapman said through an interpreter. “My high fastballs, they were fouling off, and my command wasn’t as sharp as I wanted. I’m happy I was able to get the job done.”

During his short time with the Yankees, Chapman has struggled more than once when the conditions have been wet, and Wednesday night was no exception. It likely didn’t help that he had pitched just once — an appearance in Pittsburgh on Saturday — in over a week.

His normally pinpoint command was absent, and of the 33 pitches he threw, only one topped 100 mph. For Chapman, it was an uncharacteristic performance.

He walked Andrew Benintendi to open the inning and gave up a double to Mookie Betts. Chapman then got Mitch Moreland to ground out to third, scoring Benintendi from first.

That brought up Hanley Ramirez as the potential tying run.

Chapman, who had walked just two batters in 6 ¹/₃ innings on the season, walked Ramirez, and suddenly the Red Sox were one swing away from an improbable win.

After whiffing Jackie Bradley Jr., Chapman faced Rutledge, who sent a towering shot that briefly looked like it could be a game-winning homer over the Green Monster.

Instead, the ball went foul and Chapman struck out Rutledge to end the threat.

“Once he hit it, I knew it was foul,” Chapman said.

Romine agreed.

“I knew it was foul off the bat,” Romine said. “I had the best seat in the house for it. I’m glad it was foul because I knew we were going to win the game after that.”

He was right — and the catcher was impressed by the fact Chapman survived without his usual dominance.

“I saw a guy grinding it out out there,” Romine said. “Sometimes you don’t have the best stuff you can have. He’s still pretty good when he doesn’t have it. We were pitching there for a while instead of just throwing. … No one thought anything was gonna happen. We had full confidence in what he was gonna do.”

“[Chapman] got an out when he had to it,” manager Joe Girardi said. “It was a battle. He had to throw a lot of pitches to get through it. It’s part of the game.”