BALTIMORE -- The hip-hop music resounded from the clubhouse into the manager's office, and although it wasn't exactly Sam Perlozzo's favorite tune, it couldn't have sounded any sweeter.
"We battled. We could have shut that game down, and we didn't," said Perlozzo, in his second month as a big league manager. "It's good to get that win out of the way."
Melvin Mora homered before driving in the tiebreaking run with an eighth-inning single, and soon after that the Orioles cranked up the music to celebrate the end of their longest skid of the season.
"I'm not going to lie. We needed this win, big-time," Perlozzo said. "For a ball club that lost five in a row and not played very well in the last 10 days or so, to come back the way they did was a great effort."
Miguel Tejada, Jeff Conine and Jay Gibbons also homered for the Orioles, who trailed 5-2 in the sixth inning and 6-4 in the seventh.
Magglio Ordonez homered in the fourth straight game for the Tigers, who have lost three straight and four of five.
"This is one of those little tests. You find out what you're all about," Detroit manager Jim Leyland said. "We had some early opportunities to see how we do when we win. Now, we have some early opportunities to see how we do when we lose a couple."
After Ordonez gave the Tigers a 6-4 lead with a seventh-inning homer off Todd Williams, Baltimore tied it in the bottom half against Fernando Rodney (1-1), who came in with a spotless ERA over 13 innings. After Mora homered on Rodney's second pitch, Gibbons hit a one-out drive to center to tie it.
The Tigers got runners on second and third with two outs in the eighth against LaTroy Hawkins (1-1) before the right-hander struck out Ivan Rodriguez.
In the Orioles' half, Kevin Millar led off with a walk and was replaced by pinch-runner Luis Terrero. After a sacrifice bunt and a flyout, Carlos Guillen fumbled a grounder by Chris Gomez for his second error of the game, and Mora followed with a soft single to left.
"The first one, the ball was coming out of my glove, too," Guillen said. "I'll have to see my glove tomorrow."
Said Leyland: "We gave them a couple of extra opportunities to score and they took advantage of them. We just didn't hold on to it tonight."
Chris Ray worked the ninth for his eighth save in eight chances.
"We needed that win. The attitude in the clubhouse has been down a little bit," Mora said.
Baltimore starter Daniel Cabrera gave up five runs, five hits and seven walks in five innings. Four of those walks turned into runs, and just over half his 106 pitches were strikes (54).
Detroit's Nate Robertson allowed two earned runs and six hits in 5 1/3 innings.
The Tigers went up 5-2 with a three-run fifth. Two walks and a single by Rodriguez loaded the bases for Guillen, who collected three RBI with an opposite-field double off the left-field wall.
Conine brought Baltimore to 5-4 in the sixth, hitting his fifth homer after Ramon Hernandez drew a leadoff walk.
Ordonez gave the Tigers some breathing room with his seventh-inning home run, but the lead wouldn't last.
Baltimore went ahead 2-0 with two unearned runs in the third inning. After Guillen muffed a two-out grounder to short, Tejada hit his ninth home run.
The Tigers answered with a two-run fourth. Guillen and Craig Monroe drew walks before Omar Infante hit a twisting liner to right that eluded the glove of a diving Gibbons and went for a triple.
Rodriguez played 1B for the first time in his big league career. The 12-time All-Star catcher started in place of slumping Chris Shelton. ... Cabrera leads the majors with 32 walks (in 37 1/3 innings). ... Ordonez has 10 homers this season after hitting eight in 82 games last season. ... Gibbons also has 10 home runs, including four in his last seven games.