Baltimore scored three times in the top of the fifth, two of the runs scoring on a home run from Danny Valencia, to give the Orioles a 4-2 lead.
New York, however, quickly responded by batting around in the bottom half of the inning to take control of the opening game of the series.
New York kept it going with a double by Austin Romine, a single by Brett Gardner and a walk to Derek Jeter that loaded the bases. T.J. McFarland then relieved Gonzalez and was greeted by a two-run single from Robinson Cano.
The Yankees' comeback gave the win to starter CC Sabathia (12-11), who gave up five runs on seven hits in 5 2/3 innings.
Mariano Rivera retired the side in order in the ninth for his 39th save.