Markakis put the Orioles ahead 3-1 with a fifth-inning sacrifice fly to score Mark Reynolds.
Two innings later the Baltimore outfielder gave the Orioles a 4-2 advantage with an RBI double, and then scored on J.J. Hardy's single to provide the winning margin.
Wilson Betemit went 2-for-4 with a solo homer for the Orioles, who took the opener of a three-game series.
Miguel Gonzalez (3-2) earned the victory despite surrendering four runs on six hits. The rookie right-hander didn't allow a walk and struck out eight.
2014: NFL Cheerleaders [PHOTOS]
Michael Sam cut from the Dallas Cowboys