Trailing 3-1 in the seventh inning, the Yankees scored three times to grab control of the game.
Steve Pearce collected a one-out single off Orioles starter Wei-Yin Chen (12-8) and one out later Jayson Nixed coaxed a walk. Nunez followed by looping a run-scoring single into left field, chasing Chen.
Pedro Strop came in and walked both Ichiro Suzuki and Derek Jeter to force in the tying run and send Nunez to third. The decisive play came when Orioles shortstop J.J. Hardy mishandled Nick Swisher's grounder, allowing the go-ahead run to score.
Boone Logan (6-2) earned the win with two shutout relief innings and Rafael Soriano racked up his 35th save for the American League East-leading Yankees, who evened their three-game series.
Chen ended up allowing four runs (three earned) on four hits over 6 2/3 frames.
Matt Wieters homered for Baltimore.
Couple mistakenly served bag of cash at McDonald's drive-thru
Jordana Brewster on Paul Walker: 'He was an enormous presence in my life'