Updated

While the New York Yankees are desperately trying to reach the postseason, Boston's motivation is only the rival on the other side of the diamond.

That was plenty good enough on Tuesday at Fenway.

Jacoby Ellsbury's fourth hit of the game, a solid single to right, plated Pedro Ciriaco with the winning run in the ninth, as Boston edged the Yankees, 4-3, in the first contest of a three-game set.

"It's a great feeling," Ellsbury said. "We just want to keep putting on that show for the rest of the season with the games we have left."

Dustin Pedroia finished with three hits, including a solo home run, and two runs batted in, while Ciriaco posted two hits and scored twice for Boston, which had dropped four straight coming into the contest.

Jon Lester labored through 5 1/3 frames, throwing just 55 of his 102 pitches for strikes, walking seven and giving up three runs and five hits. Andrew Bailey (1-0) pitched a scoreless ninth for the victory.

Nick Swisher finished with two hits and Derek Jeter drove in two runs for the Yankees, who dropped into a tie for the American League East lead with Baltimore, which downed Tampa Bay, 9-2, earlier on Tuesday.

"We have to try to string together some wins," Jeter said. "If you keep winning and losing, winning and losing and the other team's doing the same, they're going to gain ground on you."

Hiroki Kuroda gave up three runs on eight hits in 6 1/3 frames, but David Robertson (1-7) lost it in the ninth, giving up the winning run after pitching a scoreless eighth. He moved his way through the eighth, striking out the side before running into immediate trouble in the ninth.

Ciriaco singled with one out and moved to second when Mike Aviles rolled an infield single to deep shortstop. Ellsbury followed with the base hit to right, and Ichiro Suzuki's one-hop throw home was just behind the sliding Ciriaco to end the game.

The Yankees struck first, getting their first two runners on base with Jeter's walk and Swisher's double. After an Alex Rodriguez groundout, Robinson Cano's roller to first plated Jeter for the game's first run.

After the Red Sox escaped a two-on, no-out jam in the top of the third, they used the momentum to seize the lead in the home half. Ciriaco doubled to left and moved to third on a groundout before Ellsbury knocked him in with a single to center.

He then manufactured a run by stealing second and racing home on Pedroia's two-out single.

Lester kept dodging bullets until it finally caught up with him in the sixth. He walked Curtis Granderson and gave up a single to Andruw Jones before Jayson Nix sacrificed both runners up one base. Jeter's ground-rule double gave the Red Sox the lead and chased Lester.

Pedroia's solo home run over the Green Monster in left tied the game in the bottom of the frame, and Boston had a chance to take the advantage in the next inning, but Joba Chamerlain got Daniel Nava to ground into a force out with runners on the corners to end the threat.

Game Notes

The Yankees have alternated wins and losses in their last six games ... Pedroia's home run was his 15th of the season ... The Yankees hold a 8-5 edge in the season series.