Nate McLouth drove in the decisive run for the Orioles, who moved 18 games over .500 for the first time since the end of the 1997 season.
In the Tampa Bay ninth, pinch-runner Rich Thompson was on second with two outs when Evan Longoria topped a pitch from Jim Johnson (2-1) down the third-base line. Machado picked it up and faked a throw to first as Thompson rounded third. Machado flipped the ball to shortstop J.J. Hardy at third base, starting a rundown that ended with Thompson being tagged out by catcher Matt Wieters.
"I was trying to get Evan out to be honest, but then when I came up I saw I had no chance," Machado said. "So I did a pump-fake and tried to deke the runner. It was just natural. I just came out and didn't think about it."
The Orioles will seek to complete a three-game sweep of Tampa Bay on Thursday.
B.J. Upton homered for the Rays, who fell three games behind the Orioles.
In other games: *
At Chicago, Max Scherzer (16-6) pitched six effective innings, Prince Fielder hit a three-run homer and the Detroit Tigers beat the White Sox, 8-6, to move within a game of the AL Central lead.
* At Minneapolis, Billy Butler had three hits and three RBI, and the Kansas City Royals' bullpen logged four scoreless innings in a 10-5 win over the Minnesota Twins.
* At Toronto, Miguel Olivo hit a solo homer, Kevin Millwood (6-12) won consecutive starts for the first time since May and the Seattle Mariners beat the Blue Jays, 3-2.
* At Arlington, Josh Hamilton and Adrian Beltre homered before each left the game with injuries, and the Texas Rangers beat the slumping Cleveland Indians, 5-2.
Hamilton didn't take the field in the top of the eighth inning because of left knee soreness. Beltre exited in the fifth with a strained left shoulder.
* At Boston, Curtis Granderson hit two home runs, Robinson Cano also homered and the New York Yankees beat the Red Sox, 5-4, to remain tied for first. Derek Jeter left in the eighth after pulling up lame running out a doubleplay grounder.
In Yankees news, Andy Pettitte (broken left ankle) threw another simulated game and said he believes he can rejoin the rotation immediately.