Machado, a 20-year-old, first-round pick by the Orioles in the 2010 MLB draft, belted his first homer -- a solo shot -- in the fifth inning, putting Baltimore ahead 3-1.
His second was a three-run shot to the same spot in the left-field bleachers in the next frame, knocking Royals starter Luke Hochevar (7-10) out of the game.
Omar Quintanilla went 3-for-4 with a two-run bomb for the Orioles, which came into the game in a three-way tie with Oakland and Detroit for the American League wild card lead.
Miguel Gonzalez (4-2) held the Royals to one run on six hits over eight innings, walking one and striking out five as Baltimore evened its four-game series at one victory apiece.
Hochevar ended up surrendering seven runs on seven hits over 5 1/3 frames for Kansas City.
Salvador Perez socked a solo homer for the losers.