Alex Cobb earned his career-high 12th win for the Rays, who interrupted a 4-9 slide and kept alive their slim playoff hopes.
Ramos connected in the second inning and Longoria homered in the third for a 5-2 lead. Both drives came off Jimenez, who likely pitched his final home game with the Orioles following a rocky four-year stint.
Jimenez (6-11) gave up six runs and eight hits in three innings. He was booed lustily by the home fans after each Tampa Bay home run.
Since signing his $50 million contract in 2014, Jimenez has at times been effective. Mostly though, he's been a disappointment.
Jimenez has a 6.81 ERA this season after bouncing between the rotation and the bullpen. He's 2-4 with a 7.86 ERA at Camden Yards, and the fans have been anything but forgiving.
The right-hander's only winning season with the Orioles came in 2015, when he went 12-10, and he's 32-42 overall with Baltimore.
After a 1-2-3 first inning, Jimenez hit a batter to open the second and gave up successive singles to load the bases for Ramos, who lined a shot over the wall in left-center.
That was enough offense for Cobb (12-10), who allowed three runs and nine hits in six innings. The right-hander is 6-2 lifetime against the Orioles, including 2-1 in four starts this season.
Chris Davis hit his 25th home run for Baltimore. The defeat left the Orioles at 74-81, so they will have to win their final seven games to avoid their first losing season since 2011.
RECORD BOOK FODDER
Rays: Tampa Bay has hit 216 home runs this season, matching the club record set last season. Ramos almost hit No. 217, but a replay on his eighth-inning drive reversed the original call of a homer into a double.
Orioles: Adam Jones had two hits to up his total with Baltimore to 1,615 and move past Brady Anderson into fourth place on the team list. ... With his 224th HR as an Oriole, Davis moved past Rafael Palmeiro into sole possession of sixth place on the team's career list.
Orioles: Closer Zach Britton had a stem-cell injection into his ailing left knee. Asked to assess the chances of Britton pitching again this season, manager Buck Showalter said, "There's that possibility. I'm not going to handicap it."
Rays: RHP Jake Odorizzi (9-8, 4.46 ERA), who is 1-0 with a 6.10 ERA in two starts against Baltimore this season, starts for Tampa Bay on Saturday night.
Orioles: Jeremy Hellickson (2-5, 7.29 ERA), who pitched for the Rays from 2010-14, makes his first career start against Tampa Bay. He was obtained by Baltimore from the Phillies shortly before the July 31 non-waiver trade deadline.
More AP baseball: https://apnews.com/tag/MLBbaseball