The Yankees appeared headed for their sixth straight victory but three New York relievers combined to blow the lead and the game.
Cody Eppley, on the mound for the Yankees to start the ninth, gave up a leadoff single to Alex Rios. Clay Rapada replaced Eppley and A.J. Pierzynski hit a grounder right back to the pitcher -- who threw to second in an attempt to get the lead runner, but threw wildly for an error that put runners on first and third.
David Robertson (0-2) then came on for Rapada and his second pitch to Viciedo was hit into the left field seats.
The Yankees wasted a strong 7 1/3-inning performance by Ivan Nova, who allowed one run on six hits. Nova missed out on a chance to win his 10th game of the season.
Chicago's other run came on a solo homer by Alejandro De Aza in the fifth.
Viciedo's blast made a winner out of reliever Hector Santiago (2-1), who surrendered the Teixeira home run in his only inning of work. Addison Reed survived a leadoff single in the ninth to collect his 11th save.
2014: NFL Cheerleaders [PHOTOS]
Michael Sam cut from the Dallas Cowboys