Both teams scored five times in the first inning and both had 14 hits, but it was the seventh inning that put New York in front to stay. The Yankees handed Boston its fourth straight loss.
The game took almost 4 hours to play, leaving the Red Sox and Yankees with little rest prior to playing a day-night doubleheader Saturday.
Teixeira finished with four RBI, having delivered a two-run single during New York's five-run first. Robinson Cano also drew a bases-loaded walk in that inning, and both Nick Swisher and Eric Chavez had a sacrifice fly.
Boston's five-run first featured a three-run homer from Jarrod Saltalamacchia.
The Red Sox took a 7-6 lead into the seventh before the Yankees came up with their decisive inning.
The win went to Boone Logan (4-0), who pitched 2/3 of an inning in relief of New York starter Hiroki Kuroda. Boston got to Kuroda for seven runs on 10 hits in 5 2/3.
Rafael Soriano worked the final 1 1/3 for the Yankees, striking out two to earn his 20th save.