BOSTON — Despite playing for the rival New York Yankees and on the verge of closing the door on another New York victory, Mariano Rivera trotted in from the right-field bullpen to a standing ovation from the Boston faithful on Saturday.

Red Sox fans were quick to display their appreciation for baseball’s career saves leader, who is set to retire at the end of the season.

It also likely was one of the few familiar faces the fans recognized in pinstripes.

Hiroki Kuroda pitched seven strong innings, the injury-riddled Yankees broke through with a three-run seventh inning and Rivera added another save to his historic total during a 5-2 win over the Red Sox at Fenway Park.

Story continues below advertisement.

“I always love to pitch here, always,” said Rivera, adding that he did not notice the cheers. “Yankee Stadium’s home, but I love to come here. It’s a great atmosphere. We’ve played big games here. It’s always good.”

Eduardo Nunez, Lyle Overbay and Brett Gardner each had three hits for the Yankees, who snapped a three-game losing streak and moved to within six games of American League-East leading Boston.

Mike Carp had three hits and David Ortiz added two for the Red Sox, who lost for the third time in their last eight games.

But it was Rivera who got the hometown treatment, receiving perhaps the biggest ovation of the game, even those directed toward the Red Sox.

He allowed a single in the ninth but struck out Jonny Gomes and Jarrod Saltalamacchia for his 31st save this season and the 639th of his storied 19-year career.

“That doesn’t surprise me. He deserves it,” teammate Lyle Overbay said of the show of support in a visiting park. “I think everybody’s embracing what he’s done as a pitcher, so it’s well deserving and shows you the respect they have for him.”

Rivera is also one of the few perennial All-Stars remaining on the field for the Yankees, who are far from the same Bronx Bombers that New Yorkers have grown accustomed to rooting for.

After missing the first 91 games of the season, shortstop Derek Jeter was placed on the disabled list Friday because of a right quad strain, joining an All-Star cast on the sideline that includes third baseman Alex Rodriguez, who is slated to return to the team on Monday, first baseman Mark Teixeira (strained right wrist), outfielder Curtis Granderson (broken pinkie) and catcher Francisco Cervelli (broken right hand).

“There’s not too many nights where we’re going to slug. That’s not who we are,” New York manager Joe Girardi said. “We have to pitch extremely well, we have to get distance from our starter and allow our bullpen to go to work and have a lead. Having the lead is really important.”

Kuroda (9-6) handled the first part.

The right-hander outdueled John Lackey, holding Boston to three singles through six innings. Kuroda allowed two runs and five hits, with four strikeouts and one walk in winning his second straight start.

“It was a close game all along, so I had to be careful with my pitches,” Kuroda said through a translator. “But when they gave me the run support, I think I was able to be more bold.”

New York led 1-0 after Gardner’s RBI single in the fifth inning and got timely hits from more than half of its unheralded lineup in the seventh.

Nunez doubled and scored on Luis Cruz’s single, Robinson Cano extended his season-high hitting streak to 11 games with an RBI single off reliever Matt Thornton and Overbay made it 4-0 with an RBI single to left.

Boston broke through against Kuroda in the bottom of the seventh on a sacrifice fly by Gomes and cut the lead to 4-2 when Carp scored on a wild pitch, but that was all the Red Sox could muster.

After a scoreless eighth by David Robertson, Cano tacked on an insurance run for New York with a sacrifice fly in the ninth.

Lackey (7-7) allowed four runs and 10 hits, with no walks and seven strikeouts in 6 1/3 innings, snapping his streak of allowing two earned runs or fewer at six straight starts.

He tried to keep pace with Kuroda but couldn’t in the end.

“It makes it kind of fun, really, try to match the other guy,” Lackey said. “When you do it, it’s nice.”

Kuroda was sharp from the outset, retiring nine straight between the second and fourth innings before Carp singled to lead off the fifth.

Carp later tried to score on a pitch that escaped catcher Chris Stewart, but Stewart chased the ball down before firing to Kuroda, who laid his glove in front of the plate in time to catch Carp.

“You know eventually as you’re getting older that your stuff is going to change, or your swing’s going to change, or you’re not going to move as well defensively,” Girardi said of the 38-year-old Kuroda. “But it has not seemed to affect him and he’s throwing the ball maybe better than last year.”

NOTES: The start of the game was delayed 21 minutes because of the threat of thunderstorms. … Boston SS Stephen Drew was activated from the disabled list before the game. Drew missed 16 games because of a right hamstring strain. INF Brock Holt was optioned to Triple-A Pawtucket. … The Red Sox are the only AL team and one of two major league clubs (Atlanta) whose record has been above .500 all season. … New York recalled OFs Melky Mesa and Thomas Neal from Triple-A Scranton/Wilkes-Barre before the game. It is Mesa’s first stint with the Yankees this season and Neal’s second after joining the club from June 14 to June 23. … Boston manager John Farrell moved LHP Jon Lester’s scheduled start back from Sunday to Tuesday in order to give one of his aces extra rest after the All-Star break. RHP Ryan Dempster (5-8, 4.24 ERA) will pitch in the finale of the three-game series on Sunday night against New York LHP C.C. Sabathia (9-8, 4.07).