ST. PETERSBURG, Fla. -- Nelson Cruz put on quite a show on Sunday.
"Nelson has been spoiling us at a high level all year as a teammate and a player," Orioles manager Buck Showalter said.
Baltimore trailed 4-2 before Cruz's bases-loaded triple against Joel Peralta in the ninth. Tampa Bay tied it at 5 in the bottom half on pinch-hitter Sean Rodriguez's run-scoring grounder off closer Zach Britton.
Baltimore increased its margin in the division to 9½ games over the New York Yankees, who lost 2-0 to Kansas City.
"It wasn't a pretty victory but we got it done and that's the important thing," Cruz said. "You don't want to think about the standings too much but we are in pretty good shape and we just have to remain focused."
The Rays went 0 for 9 with runners in scoring position.
Orioles outfielders Adam Jones and Nick Markakis were out of the starting lineup, receiving a break from the artificial turf at Tropicana Field. Shortstop J.J. Hardy missed his second consecutive game due to back spasms.
Jones had a pinch-hit single in the ninth.
Longoria and Loney hit consecutive homers off Bud Norris in the first. Longoria has 39 RBIs in 47 games since the All-Star break.
DeJesus made it 3-0 with his fourth career inside-the park homer during the fourth. Left fielder Alejandro De Aza had the ball knocked out of his glove when center fielder David Lough ran into his teammate's arm. The ball ended up around the foul line, which allowed DeJesus to easily reach home.
Norris gave up four runs and eight hits in six innings.
Cruz's two-run shot off Jeremy Hellickson made it 3-2 in the sixth. Hellickson allowed two runs and four hits over 5 1/3 innings.
"It does feel like a lot of our losses came like this," Hellickson said.
Tampa Bay has lost 14 of 22 since reaching .500 after dropping 18 games under the break-even mark.
The Rays went ahead 4-2 on Kiermaier's sixth-inning homer.
Orioles: Hardy expects to play in Monday night's game at Boston.
Cruz is the first Baltimore player with seven RBIs in a game since Luke Scott against Seattle on July 7, 2009. He is the first player with at least seven RBIs to account for all of his team's RBIs since Colorado's Jason Giambi on May 19, 2011, at Philadelphia. In 18 previous games against the Rays this season, Cruz had two homers and seven RBIs.