Markakis hit a three-run homer and Roberts added a two-run shot to help the Orioles stop a six-game losing streak with an 8-4 victory over the Tampa Bay Rays on Monday night.
"It was time for us to get one on our side," Baltimore manager Dave Trembley said. "We couldn't let it beat us."
Markakis, after the first two Baltimore batters walked, made it 3-0 with his three-run shot off Scott Kazmir (3-3) in the first. He has a hit in 19 of his last 20 games, and has reached base safely in 35 straight games, which is the longest active streak in the majors.
"It's been rough, but it's a long season," said Markakis of the Orioles, who won for just the fourth time in 18 games.
After Aubrey Huff had a sacrifice fly and Ty Wigginton hit an RBI double off reliever Joe Nelson in the seventh, Roberts extended the Orioles' advantage to 8-4 on his eighth-inning homer. Reliever Danys Baez (2-1) threw two scoreless innings for the win.
Roberts singled in the seventh to stop an 0-for-18 slide. Adam Eaton gave up four runs and five hits over five-plus innings.
"I hit the ball hard, had some at-bats that weren't great, but I wasn't all that concerned abut it," Roberts said. "It felt good to contribute because I felt like I hadn't in a while."
Evan Longoria homered for the Rays, who were coming off a series in which they won three of four against the Boston Red Sox. Tampa Bay, which went 15-3 last year against Baltimore, have lost three of four to the Orioles this season.
"I saw a lot of good stuff, actually," Tampa Bay manager Joe Maddon said. "They just beat us. We didn't get a hit when we needed it. They beat us in the bullpen tonight."
Kazmir allowed six runs and seven hits in 6 1/3 innings.
"That pitch [a hanging slider] to Markakis shouldn't happen," Kazmir said. "It's a real good pitch to hit."
Longoria pulled Tampa Bay within 3-1 on his 8th homer in the bottom of the first. The 2008 AL rookie of the year has three homers and driven in nine runs over his last five games.
Jason Bartlett's second RBI grounder of the game cut the Rays' deficit to 4-3 in the fourth.
The announced crowd was 12,658. Tampa Bay started the day with a home attendance average of 28,867.
"I thought before the game the intensity level was up as usual," Rays left fielder Carl Crawford said. "We felt the same, did everything like we normally do. We just couldn't pull it out tonight."
Crawford, who tied the modern record of six stolen bases in a game Sunday, is sending his spikes to the Hall of Fame. He stole second in the seventh on Monday, giving him a stolen base in a team-record seven consecutive games. ... Orioles RHP Dennis Sarfate (numbness in his right middle finger) is undergoing additional tests in Baltimore. Tests performed in Canada when the Orioles played in Toronto over the weekend are being sent to Baltimore. Trembley doesn't expect to have more information on Sarfate until at least Tuesday. ... Baltimore OF Lou Montanez (right thumb) was scratched from the starting lineup, and is day to day. ... Rays C Shawn Riggans (shoulder) will start a minor league rehab assignment Tuesday at Double-A Montgomery.