The Yanks were trailing 4-1 in the fifth but closed the gap with solo homers from Soriano and Mark Reynolds.
That brought up Soriano, who sliced an 0-1 pitch over the fence in right-center field for the key blow.
Adam Warren (2-2) earned the decision and Mariano Rivera recorded the final four outs for his 42nd save as the Yankees moved within two games of Tampa Bay for the second and final American League wild card spot.
Chris Davis belted his 49th homer of the season for Baltimore, which remained 1 1/2 games behind the Rays with the loss, which came after a 4-2 victory over the Yanks Monday's opener of a key four-game series.
Florida bear attack: Black bear mauls woman's face
Toddler uninjured after being knocked over by Obama family dog