With the score tied 2-2 in the third inning, Markakis pounded a 2-1 pitch from Phil Hughes (0-2) into the right-field seats, putting the Orioles ahead to stay.
Ryan Flaherty and Nathan Reimold each delivered a solo shot for Baltimore, which evened its three-game series at Yankee Stadium.
Jason Hammel (2-1) earned the victory, limiting the Yankees to three runs (two earned) on eight hits and a walk through six innings. He struck out four.
Hughes ended up yielding five runs on nine hits over three full frames for New York.