BOSTON (Reuters) - With his team trailing 2-0, the bases loaded and the league's best batter at the plate, New York Yankees reliever Boone Logan could not have picked a more testing time to take the mound against bitter rivals Boston at Fenway Park on Friday.

However, Logan did not let the pressure get to him, striking out Adrian Gonzalez to end the fifth inning and spark his team to a 3-2 win that saw them take top spot above the Red Sox in the American League East.

The win was just New York's second in 10 attempts against Boston this season.

"That strikeout of Gonzalez, who's been a great hitter all year long and for a long time, it's huge," Yankees manager Joe Girardi said.

"Bases loaded, there's no room for error on Boone's part. He was aggressive and expanded the zone when he had a chance. It was a huge strikeout."

New York's offense responded in the sixth inning with three runs against Red Sox starter Jon Lester, who had been in top form through the first five.

"They did a good job being patient in the sixth, they laid off some good pitches," said Lester (11-5). "For the first five innings, we dictated both sides of the plate. In the sixth, they did."

Former Red Sox pitcher Bartolo Colon started for the Yankees and allowed two runs on six hits in four and 2/3 innings before giving way to Logan, who earned the win to improve to 3-2.

Logan and three relievers delivered the lead to Mariano Rivera, who pitched a clean ninth inning for his 29th save. (Reporting by Mike Mouat in Windsor, Ontario; Editing by Peter Rutherford)