ST. PETERSBURG, Fla. - Chris Davis got two extra bases thanks to technology.

Davis hit a replay-delayed grand slam and the Baltimore Orioles beat the Tampa Bay Rays 7-5 on Tuesday night.

Davis was awarded a slam off Erik Bedard (3-5) during a five-run third-inning after a video review showed his drive struck the foul pole. He reached second base on an opposite-field shot down the left-field line. The review that lasted 1 minute, 18 seconds revealed the ball hit the pole a few feet above the wall, and Davis was given a home run.

"I couldn't tell," Davis said. "I was hoping it would be fair and deep enough to where we could get at least one run in. I'll take a double, but at the same time if I can get a grand slam out of it I'll take that too."

Orioles manager Buck Showalter thought he heard the ball strike the pole.

"The way things kind of echo here, you can hear it," Showalter said. "We have things in place to get it right."

Rays left fielder David DeJesus stayed in the game after he ran hard into a low fence near the foul pole while chasing Davis' homer.

"I was kind of lucky," DeJesus said. "I hit the wall first and then I just crumbled. But last year when I separated my shoulder, I went straight into the wall with my shoulder. I had no idea if it hit the wall or hit the pole."

The Orioles also got a two-run homer from Steve Pearce.

Sean Rodriguez and Desmond Jennings homered for Tampa Bay, which is 5-16 in its last 21 games.

The Rays pulled within 5-2 in the bottom of the third when Rodriguez and Jennings hit consecutive solo homers off Miguel Gonzalez (4-4). Jennings has four homers in 22 at-bats against the Baltimore right-hander.

Tampa Bay made it 5-4 on James Loney's two-run double during the fifth.

Baltimore went ahead 7-4 on Pearce's two-run drive in the seventh. Tampa Bay got one run back on Yunel Escobar's eighth-inning sacrifice fly.

Gonzalez, activated from the 15-day disabled list before the game, allowed four runs and eight hits in five innings. He had been out since May 31 due to a strained right oblique.

"I thought his stuff was pretty crisp, but the command wasn't what he's capable of," Showalter said.

Zach Britton pitched the ninth for his eighth save.

Bedard gave up five runs and four hits over four-plus innings.

"It really comes down to starting pitching drives the engine, and (Bedard) had a tough day," Rays manager Joe Maddon said. "We actually played a good game, we just didn't pitch well tonight."

NOTES: Davis has three career grand slams. ... Baltimore C Matt Wieters had season-ending right elbow ligament replacement surgery. The Orioles are hopeful he will be ready for opening day next year. ... Tampa Bay RHP Jeremy Hellickson (elbow) struggled in his third rehab start with Triple-A Durham, allowing seven runs and 12 hits in 2 2-3 innings. ... Baltimore INF Michael Almanzar (left knee) is scheduled play for the rookie-level GCL Orioles on Friday. ... The Rays signed RHP Brent Honeywell, taken 72nd overall in the 2014 draft. ... To make room on the roster for Gonzalez, RHP Josh Stinson was designated for assignment. ... Orioles RHP Kevin Gausman (2-1) and Rays RHP Alex Cobb (2-4) are the scheduled starters for Wednesday's series finale.