Tampa Bay reliever Chris Archer (0-3) got the first two outs in the 14th but walked Adam Jones, and Endy Chavez then followed with a single through the left side of the infield. Machado swung at a 3-0 pitch, ending up with a hit to left that dropped just in front of left fielder Sam Fuld and scored Jones.
The decision completed a three-game Baltimore sweep of the Rays. It was also the Orioles 13th consecutive extra-inning win -- a team record.
The Orioles have won 81 games this season, assuring the team its first .500 season in 13 years.
Randy Wolf (5-10), the seventh Baltimore pitcher Thursday, picked up the win with 1/3 of an inning in relief. The Orioles bullpen went 6 2/3 innings, giving up four hits and no runs.
Archer pitched 3 2/3 innings and pitched out of a bases-loaded, no-out jam in the 13th.
Tampa Bay took a 1-0 lead in the fourth inning on a sacrifice fly from Jeff Keppinger. Baltimore got a two-run double from Taylor Teagarden in the seventh but the Rays' Ben Zobrist singled in Desmond Jennings in the eighth, tying the score at 2-2.
Celebrity Breakups and divorces of 2014 [PHOTOS]