Brad Penny (11-11) gave up three runs on five hits over 5 1/3 innings for the Tigers, who won two games in the series. They are one game behind Texas for the second-best record in the American League and home field advantage in the first round of the playoffs.
"I want this team to win, with or without me in the playoffs," Penny said. "I'd like to pitch in the playoffs, but if it doesn't happen, it doesn't happen."
Nolan Reimold hit a three-run homer for the Orioles. Pedro Florimon Jr. drove in two runs.
Brian Matusz (1-9) allowed six runs on seven hits over five innings to take the loss. He struck out five and walked three.
"It's been the hardest year of my life, that's for sure," Matusz said.
The Tigers jumped out to a 2-0 lead on Cabrera's homer in the first inning.
Detroit tacked on another run in the third for a 3-0 lead. Brandon Inge walked, moved to third on Magglio Ordonez's single and scored on Delmon Young's infield single.
The Orioles scored three runs in the fifth to tie the game. Jake Fox was hit by a pitch and Reimold singled to begin the frame. A wild pitch moved the runners up a base. Florimon knocked in both runners with a double to center. Craig Tatum followed with an RBI single.
Martinez put the Tigers back up by three with one swing of the bat in the home fifth. Singles by Austin Jackson and Cabrera put runners on the corners with two outs. Martinez then cleared the wall in left for a 6-3 lead.
Kelly added a three-run homer of his own in the sixth to make it 9-3.
Reimold erased Kelly's homer with a three-run shot of his own in the eighth.
Peralta led off the home eighth with a homer to make it 10-6, and Jose Valverde closed the door in the ninth.
Baltimore and Detroit split 10 games this season...Matusz hasn't won since June 6, losing nine straight decisions...Penny improved to 3-0 versus Baltimore over five career starts.