BALTIMORE -- A rejuvenated hitting attack and the steady pitching of closer Mariano Rivera got the New York Yankees in the proper frame of mind for another important series against the Boston Red Sox.
Robinson Cano hit the tiebreaking homer in the seventh inning after New York blew a five-run lead, and the Yankees beat the Baltimore Orioles 8-7 Sunday for a three-game sweep.
Cano went 4-for-5 with two doubles, two RBI and two runs scored. Johnny Damon hit a three-run homer and Bobby Abreu had three hits for the Yankees, who scored 22 runs in their first sweep at Baltimore since May 2004.
"Guys are excited, probably a little bit fatigued, too," New York manager Joe Girardi said. "Obviously, we can look forward to what's in front of us."
The Yankees have a day off before beginning a three-game series at home against the Red Sox, who lead New York by five games in the AL wild-card race.
"Being able to sweep Baltimore definitely puts us in a much better situation against Boston," Damon said.
Brian Roberts, Melvin Mora and Aubrey Huff homered for Baltimore. Roberts, Huff and Jay Payton each had three hits, but the Orioles stranded 13 and went 2-for-12 with runners in scoring position.
The game ended when Nick Markakis looked at a third strike from Rivera with a runner on third.
Baltimore manager Dave Trembley held a brief postgame session with the media that reflected his angst over the defeat.
"I have a bunch of guys that just gave their hearts and souls to that game, and I hope you understand that," Trembley said. "I wish I would have had about 15 more minutes to sit out there with my team instead of come out here as quickly as I did. That's how tough it is for me to process."
Cano hit a solo shot that traveled an estimated 425 feet off Jamie Walker (1-2), who has yielded nine homers in 31 1/3 innings this year.
"Just a bad pitch," Walker said. "I was trying to go down and away. I didn't execute the pitch, and big league hitters, that's what they're supposed to do."
Edwar Ramirez (4-1) allowed one run in 1 1/3 innings, and Rivera, the sixth New York pitcher, recorded four outs to earn his 31st save -- the third in the series.
"This was a big game. We knew we had a chance to sweep and any time you can do that, you have to take advantage of it -- especially where we are right now," Girardi said. "We just kept swinging the bats, swinging the bats."
After getting 39 hits in the sweep, the Yankees packed their bags after a 4-2 swing through Toronto and Baltimore.
"It's always nice to come home, and we're going to have an important series at home," catcher Ivan Rodriguez said. "We've just got to keep doing what we've been doing."
Baltimore trailed 7-5 in the fifth when Girardi summoned Ramirez to face Roberts, who hit the right-hander's second pitch into the center-field bleachers to knot the score.
But New York scored last in a game that lasted more than four hours and featured 29 hits.
"Just an ugly game," Walker said. "To score seven runs and lose, it's just frustrating."
Neither starter finished the fourth inning. Bidding to go 4-0 against New York this season, Daniel Cabrera gave up seven runs, nine hits and three walks in 3 2/3 innings.
"When you lose the first two games of a series, I think you're going to have a quick hook with anybody," Trembley said.
New York's Darrell Rasner allowed five runs, three earned, and eight hits in 3 1/3 innings -- his shortest start of the year. The right-hander threw 97 pitches and retired only 10 of 21 batters.
"It was like I never pitched before. I'm disgusted with my outing," Rasner said.
Successive homers by Mora and Huff put the Orioles ahead 2-0 in the first inning. Of the five times the Orioles have homered in consecutive at-bats this season, four have come against New York.
Cabrera relinquished the lead in the second. After Cano doubled in a run, Damon hit a drive inside the right-field foul pole to make it 4-2.
New York went up 7-2 in the fourth. Jason Giambi hit a sacrifice fly with the bases loaded before Xavier Nady chased Cabrera with a two-run double.
Baltimore answered with three runs in the bottom half, an uprising that started when shortstop Derek Jeter booted a grounder. An error by Nady on a single to left allowed a run to score, and Huff followed with an RBI double before Kevin Millar hit a sacrifice fly.
Damon has 25 career home runs against the Orioles, the most any opponent. ... Cabrera failed to get a strikeout for only the second time in 144 career starts. ... New York is 8-7 against Baltimore. The Yankees haven't lost a season series to the Orioles since 1997.