Machado hit a two-run homer in the first after Oakland had jumped out to a 3-0 lead on O’s starter Chris Tillman.
His second homer of the day, and ninth of the season, was a grand slam in the eighth.
His six RBI give him 22 for the season, and Machado’s 2-for-4 day raised his batting average to .350.
Tillman (4-1, 3.05 ERA) settled down after the three-spot in the first, and pitched into the seventh to get the win.
He gave up three runs on six hits in six and a third, striking out seven and walking four.
Mark Trumbo and Jonathan Schoop each homered and had three hits for the AL East-leading Orioles (18-12).