BALTIMORE -- On a night in which the Baltimore Orioles found all sorts of ways to score, their final run was appropriately the result of an intentional walk to a .188 hitter and an opposite-field bloop.
J.J. Hardy put Baltimore ahead with a seventh-inning single, and the Orioles rallied past Tampa Bay 5-4 Thursday night to lengthen their lead in the AL East.
Steve Pearce homered for the Orioles, who took three of four from the sinking Rays. The victory, combined with the Yankees' loss to Detroit, put Baltimore seven games ahead of New York with 30 games remaining.
"To win a four-game series in the division, that's huge," winning pitcher Andrew Miller said. "Hopefully we can carry some momentum out of that."
After Pearce's first-inning homer, the Orioles scored on a delayed double steal, a bases-loaded grounder and a throwing error. Then, with the score tied at 4 in the seventh, Baltimore took its first lead.
Nelson Cruz doubled with two outs off Kirby Yates (0-2) and Chris Davis was walked intentionally despite coming to the plate with a .188 batting average. Hardy followed with a pop to right field that fell in.
Asked if he was surprised Davis received the free pass, Hardy replied, "A little bit. But I was just thinking about hitting the ball hard. Didn't happen, but it worked."
The left-handed hitting Davis said, "I see the reasoning behind it. Right-handed pitcher on the mound, right-handed hitter behind me. (I) had some good swings on a couple of balls earlier in the game."
Rays manager Joe Maddon justified his decision, noting, "Yates, the guy he's got to be able to get out is Hardy in that moment because he really matches up extremely well against him. I know it was a blooper, but the pitch was elevated and that's why he was able to do what he did."
Miller (4-5) pitched 1 2-3 hitless innings and Zach Britton worked a perfect ninth for his 29th save.
Evan Longoria homered and drove in two runs for the Rays, who lost their second road series in the last 11. It was a rough night for Tampa Bay shortstop Yunel Escobar, who made two errors, went hitless and was struck in the hand with a pitch.
Tampa Bay used a two-run fifth to take a 4-2 lead. Longoria followed two singles with a sacrifice fly and James Loney hit an RBI double.
The Orioles loaded the bases with one out in the bottom half and tied it when Escobar threw wildly to first base trying to complete a double play.
That, according to Maddon, was far more significant than the intentional walk.
"You can't do that and expect to win," he said. "Baltimore's playing at a high level. I think we have been also. We uncharacteristically gave this game up on defense tonight. And we just did and that's the story line, pure and simple."
It also hurt that each time Tampa Bay took a two-run lead, the Orioles answered a two-run uprising with one of its own.
For the fourth time in th e series, the Rays scored first, this time in the first inning against Bud Norris. After Matt Joyce delivered a sacrifice fly, Longoria hit his 17th home run.
In the bottom half, Pearce hit a solo shot and Adam Jones stole home after Cruz forced a rundown by breaking for second base. It was Baltimore's first steal of home since Robert Andino did it in June 2009.
Rays: OF David DeJesus (left hand fracture) is 5 for 17 in seven games on his rehabilitation assignment and "is close to being ready," Maddon said.
Orioles: 3B Manny Machado (knee) and C Matt Wieters (elbow) were tending to their injuries Thursday and missed being part of the annual team picture.
Rays: Tampa Bay resumes its contentious rivalry with the visiting Boston Red Sox on Friday night. Chris Archer, who criticized David Ortiz after his home run trot on June 27, starts for the Rays.
Orioles: Miguel Gonzalez (6-7) takes the mound for Baltimore on Friday ni ght in the opener of a four-game series against the Minnesota Twins, the first meeting between the teams since May 4.