Kevin Youkilis hit a two-run homer to cap a three-run seventh inning that gave Boston the lead, and the Red Sox held on for a 5-4 win over the Yankees in the opener of a three-game series.
Adrian Gonzalez had a sacrifice fly during the seventh-inning rally, which snapped a 2-2 tie. The Yankees scored a run in each of the last two innings, but stranded the tying run at first base in the ninth.
Clay Buchholz (4-3) pitched seven innings for the win, giving up two runs on five hits and a walk with seven strikeouts.
Daniel Bard and Jonathan Papelbon both gave up a run, but Papelbon hung on for his sixth save of the season.
The Red Sox snapped a two-game losing streak after being swept in a brief series in Toronto and moved to 3-1 against the Yankees this season.
"We needed a win and we played good as a team," said Gonzalez, who also had a solo homer in the victory.
Bartolo Colon (2-2) took the loss after allowing three runs -- two earned -- on five hits and three walks in six-plus innings, striking out four in his 11th career loss to the Red Sox.
Russell Martin hit a two-run homer for the Yankees, who were coming off their first home series loss to Kansas City since 1999. They have dropped three games in a row.
"[Buchholz] got a lot of swing-and-misses and a lot of people just trying to figure out what he was doing," said Yankees centerfielder Curtis Granderson, who went 2-for-5.
In the half-inning before his two-run homer, Youkilis made a charging bare- handed grab on Robinson Cano's slow grounder to third and got him by a step at first base.
Jarrod Saltalamacchia led off the seventh with a single for Boston, chasing Colon for Joba Chamberlain. Jacoby Ellsbury reached first on a force out, moved to third on Dustin Pedroia's single and scored on Gonzalez's sacrifice fly.
Youkilis went the other way on a 1-2 fastball, lining Chamberlain's pitch into the first row of seats in right field for his sixth homer of the season to give Boston a 5-2 lead.
Bard relieved Buchholz to start the eighth and Granderson greeted him with a leadoff triple. Granderson scored on a one-out wild pitch that bounced near the plate and got past Saltalamacchia, pulling the Yankees within 5-3.
The Yankees had runners at second and third base after simultaneous steals by Alex Rodriguez and Cano, but Bard struck out Nick Swisher and got Jorge Posada on a grounder to end the inning.
Derek Jeter lined a two-out single into right field against Papelbon in the ninth, took second base on defensive indifference and scored when Granderson's single got through the left side.
But Papelbon retired Mark Teixeira on a pop-up to end the game and strand the tying run at first.
Gonzalez belted a 1-0 fastball into the second deck in right field leading off the fourth inning, giving the Red Sox a 1-0 edge with his eighth homer of the season. Youkilis reached on a strike out-passed ball after that and scored later on a Carl Crawford groundout to make it 2-0.
Buchholz didn't give up a hit until Rodriguez smacked a one-out single to left field in the fourth inning.
The Yankees tied the game an inning later when Posada led off with a single and scored on Martin's seventh homer of the season. Martin drove a first-pitch fastball over the center field wall and out of the reach of a leaping Ellsbury's glove.
Colon is 8-11 all-time against the Red Sox...Buchholz moved to 2-3 against the Yankees...The Red Sox took two-of-three against the Yankees in Boston last month -- including a 9-6 win in the series opener that snapped the Red Sox's 0-6 start, their worst in 66 years...Boston (18-20) could reach .500 for the first time this season with a sweep of the Yankees.