Johnson came into the game tied with New York's Mariano Rivera for the most saves in the American League at 43 and Johnson was called on to keep the game tied in the ninth.
Instead, Johnson gave up a leadoff single to Ryan and then threw the ball away on a grounder back to the mound off the bat of Chris Stewart.
Ryan moved to third on a sacrifice and he scored when Johnson (3-8) uncorked a wild pitch with Alex Rodriguez at the plate.
With the Yankees having grabbed the lead, Rivera came on in the bottom of the ninth to retire the side in order and was given the victory by a scorer's decision to boost his record to 6-2.
New York won its third in a row remained one game behind Tampa Bay in the chase for the second wild card spot in the American League. Baltimore trails the Rays by 2 1/2 games.