NEW YORK — After Mariano Rivera blew a third straight save for the first time in his famed career, Brett Gardner homered with two outs in the ninth inning to give the New York Yankees a 5-4 victory over the Detroit Tigers on Sunday for their first series win in more than a month.Rivera (3-2) gave up another homer to a limping Miguel Cabrera and a drive to Victor Martinez in the top of the ninth, tying it at 4 and turning Alex Rodriguez’s first homer of the season into a footnote.Gardner connected off Jose Veras (0-5).Rivera has a record 643 saves, but had never failed three in a row in 1,087 relief appearances coming in. He gave up a tying homer to Cabrera in the ninth Friday night, and Gardner won it with a two-out single in the 10th.Alfonso Soriano homered for his 2,000th hit in the fourth inning. He connected off Justin Verlander, as did Rodriguez.Rodriguez, who has missed most of the year while coming back from hip surgery, hit a leadoff homer in the second. His 648th career home run pushed him past Stan Musial for fifth on the RBIs list with 1,951.Lustily booed Friday night in his season debut at Yankee Stadium, he quickly turned fans around Sunday with a soaring shot to left field that made it 1-all. Rodriguez drove in one more run with a single down the first base line in the third.Late lineup-addition Brayan Pena homered in the eighth off Yankees setup man David Robertson, cutting Detroit’s deficit to 4-2.On a glorious August afternoon in the Bronx, the Yankees avoided dropping to .500 for the first time since April 13, improving to 59-57. Taking two of three from the AL Central leaders gave New York its first series win July 5-7 after an 0-5-3 stretch.Gardner started a long-distance double play to end the eighth inning by leaping against the center field wall to catch Torii Hunter’s fly and preserve the 4-2 lead.But Rivera stunned the crowd, allowing the fifth two-homer game in his career. He stood with his head hanging after Martinez homered for his third hit of the game. It appeared as if he raised his hands to ask, “What is going on?”Prince Fielder had an RBI single in the first off Andy Pettitte, the eighth straight game the lefty allowed a run in the opening inning. That’s the longest such streak by a Yankees pitcher, according to STATS research back to 1920.Rodriguez made a stellar play in the eighth when he reached deep behind third base on Austin Jackson’s grounder and threw to second to nail Jose Iglesias for the first out.Tigers manager Jim Leyland disputed the call, and TV replays appeared to back him up.Leyland was back on the field one batter later. Shaken after catching Hunter’s fly, Gardner flipped the ball to Soriano. The left fielder threw the ball to shortstop Eduardo Nunez, who tossed it to second baseman Robinson Cano. Cano easily tagged Austin Jackson, who stood confused on second base.Half the team met Gardner at the dugout step to congratulate the center fielder. They all pounced on him after his homer.