For the first time in well over a month, the Tampa Bay Rays experienced the sensation of a blowout loss.

It didn't sit well, especially because it came against one of the two teams the Rays are chasing in the AL East.

J.J. Hardy homered twice, doubled and drove in five runs, and the Baltimore Orioles defeated Tampa Bay 9-2 Tuesday night to move into a tie for the division lead.

The loss dropped the Rays two games behind Baltimore and the New York Yankees with 21 left to play. It was the first time since Aug. 4 that Tampa Bay lost by more than two runs; eight of its previous 12 defeats were by one run.

Ryan Roberts and Elliot Johnson hit solo homers for the Rays, who used five pitchers — each of whom gave up at least a run.

Starter Matt Moore (10-10) threw 94 pitches over four innings before being lifted by manager Joe Maddon. The left-hander allowed two earned runs on four hits and three walks.

"This team always rides on the strength of its starting pitchers, and Matt was a little bit different than he normally is," Johnson said. "But I don't want to make it seem like it was all on the pitching staff. Offensively, we didn't really get anything going. Two solo home runs — we've got to do a better job than that."

It was Tampa Bay's most lopsided loss since a 4-0 defeat against Baltimore at home.

"Anybody can get beat by a lot of runs any night," Roberts said. "It didn't go our way tonight, and that's how it happens sometime in baseball."

Roberts left in the sixth inning with a left forearm strain, the result of a tag he made at second base. X-rays were negative, and he held out hope of playing Wednesday in the next game of the three-game series.

"I'm just glad it isn't broke," Roberts said. "If it's up to me, I'm playing. We're in a tight race and these games mean a lot, so I definitely want to play even if it's going to hurt a little bit."

Orioles starter Jason Hammel left in the fourth inning with an injured right knee. The right-hander underwent arthroscopic surgery on that same knee in mid-July and was making his second start since returning from the disabled list.

Hammel will be examined Wednesday by the team surgeon. He said the sensation was exactly identical to what he felt in a July 13 game against Detroit, his last start before going on the DL.

"It's a very sharp pain in the knee in the same spot," Hammel said. "I'm hoping it is just scar tissue. I've been told scar tissue can react like that."

On Saturday, Baltimore lost right fielder Nick Markakis with a broken left thumb while defeating the Yankees. Both Hammel and Markakis were on the DL earlier this year.

Steve Johnson (3-0) got the win with 1 1-3 innings of hitless relief.

With Markakis out, Hardy picked up the slack. He hit a two-run homer in the third inning, doubled and scored in the fifth, singled in a run in the sixth and added his 21st homer with a runner on in the eighth. It was his ninth career two-homer game, the second this season.

Chris Davis homered and Matt Wieters had three hits and two RBIs for Baltimore.

After Moore left, Burke Badenhop entered with a run of eight straight scoreless appearances and promptly gave up a double to Hardy, a single to Adam Jones and two-run double to Wieters that provided Baltimore with a 5-1 lead.

Hardy's sixth-inning RBI single came off Cesar Ramos and Davis hit his 25th homer in the seventh off J.P. Howell.

Johnson connected against Darren O'Day leading off the eighth, and Hardy homered off Dane De La Rose in the bottom half.

The victory improved Baltimore's record against AL East foes to 33-24 compared to 28-44 last year.

Baltimore broke on top with an unearned run in the first inning. Jones walked and scored when Matt Joyce fumbled Wieters' two-out single to right.

Hammel retired the first eight batters before Roberts connected in the third. It was his fourth homer with Tampa Bay since in coming over in a trade with Arizona on July 24.

In the bottom half, Robert Andino led off with a double and Hardy homered to put the Orioles ahead for good.

NOTES: Baltimore leads the season series 7-6 and took the lead in the all-time series, 127-126. ... This was the first of 15 consecutive games against AL East foes for the Rays, who head to Yankee Stadium after this series. ... The Rays will send Alex Cobb to the mound Wednesday night and the Orioles will start rookie Miguel Gonzalez, who's 0-1 with a 6.52 ERA in two starts against Tampa Bay.