More often than not, the middle of the Detroit Tigers' lineup will handle the brunt of the offense.

Sometimes, though, the Tigers will have to depend on the other guys to produce the hits and runs necessary to win.

Such was the case against the Baltimore Orioles on Friday night, when Wilson Betemit homered and rookie Andy Dirks had a career-high four hits in a 5-4 victory.

Betemit, the No. 9 hitter, had three hits. Dirks went 4 for 4 with a walk and singled in the tiebreaking run in the sixth inning.

"That's what a club needs to win games," manager Jim Leyland said. "It's nice when you get contributions from everybody. In the end, the big bats are going to carry you, but it's always nice when some other guys chip in."

Acquired in a July 20 trade with Kansas City, Betemit had three hits and is 9 for 17 in his last five games. Since the trade, he's batting .347 with two homers, three doubles and 10 RBIs.

Dirks, meanwhile, finds himself in the pennant race after spending last season with Double-A Erie and Triple-A Toledo.

"Once you get out on the field you don't feel like a rookie," he said. "You're just like any other player and you do what you can to help the team win."

Alex Avila had two hits and scored twice to help the first-place Tigers maintain their three-game lead over Cleveland in the AL Central.

"It's a team game and everybody has to contribute and do their part," Dirks said. "That's what makes a good ballclub. You can't count on just a few guys to carry you every night."

Detroit received 3 2-3 innings of one-hit relief from a stellar bullpen that has an 0.84 ERA over the last eight games.

J.J. Hardy hit two homers, but his third multihomer game of the season was not enough to prevent Baltimore from losing for the eighth time in 10 games. Hardy has 23 homers this season, three short of matching his career high.

"I think we battled," Hardy said. "They just came out on top."

Detroit went up 5-4 in the sixth. Austin Jackson hit a leadoff double off Troy Patton (0-1) and Dirks followed with an RBI single.

Jackson helped preserve the lead with a leaping catch at the top of the center-field wall on a drive by Adam Jones.

Brad Penny (8-9) allowed four runs and seven hits in 5 1-3 innings to snap a personal three-game losing streak.

"I didn't have the command I normally have," Penny said. "We won, and that's all I care about."

Jose Valverde, the last of three Detroit relievers, worked the ninth for his 34th save in 34 tries.

Orioles starter Alfredo Simon gave up four runs, 11 hits and three walks in 4 2-3 innings. He has yielded 21 hits in his last two outings.

Betemit's fifth homer of the season, after Avila led off the fourth with a single, put Detroit ahead 4-2. The Tigers could have had more, but right fielder Nick Markakis threw out Jackson trying to score on a fly ball and first baseman Chris Davis made a diving snag of a two-out grounder by Victor Martinez with two runners on.

Hardy hit his second homer of the game in the fifth, Jones doubled and Vladimir Guerrero broke a 1-for-24 slump with an RBI single to tie it at 4.

That, however, would be Baltimore's final run.

Miguel Cabrera put Detroit up 1-0 in the first with an RBI single, but Simon got Jhonny Peralta to hit into an inning-ended double play with the bases loaded.

Orioles manager Buck Showalter shook up the lineup in an effort to get more production from an offense held under four runs in seven of its previous 11 games. Nolan Reimold batted leadoff and Guerrero was dropped a notch from the cleanup spot for the first time this season. Reimold became the sixth different player to bat atop the order, including Brian Roberts, who hasn't played since May 16 because of a concussion.

Showalter's hunch was promptly rewarded. Reimold drew a first-inning walk and Hardy followed with a drive to left for a 2-1 lead.

A sacrifice fly by Jackson tied it in the second.

NOTES: Tigers reliever Al Alburquerque received a concussion when struck by a ball during batting practice. He was placed on the 7-day concussion DL after the game. ... Magglio Ordonez snapped an 0-for-14 skid with a first-inning single, and in the bottom half Mark Reynolds singled to end his 0-for-17 slide. ... Detroit will send Max Scherzer (11-7) to the mound Saturday night against the Orioles, who will counter with Jeremy Guthrie (5-15). Scherzer is one win short of matching his career high, and Guthrie is 3-1 with a 2.62 ERA in five lifetime starts against the Tigers. ... Orioles RHP Jake Arrieta had successful surgery Friday to remove a bone spur from his right elbow.