BOSTON (AP) — If Joel Hanrahan can do for the Boston Red Sox what he did against them, they should be very happy with their new closer.

In the first of his two All-Star seasons, the right-hander posted back-to-back saves for the Pittsburgh Pirates with perfect ninth innings against the Red Sox in June 2011. He struck out Adrian Gonzalez, who entered the series batting .359, to end the second game.

"When people look back on me as a Pirate, that's the one that stands out the most to them," Hanrahan said Wednesday after being obtained in a six-player trade.

People such as Red Sox assistant general manager Brian O'Halloran.

"It definitely made an impression on me," he said. "It was not fun to be in the batter's box against Joel Hanrahan."

The Red Sox also announced the signing of free agent shortstop Stephen Drew, who agreed to a one-year contract early last week. The reported $9.5 million deal was contingent on Drew passing a physical. The former Oakland Athletic and Arizona Diamondback broke his ankle in 2011.

"We feel that he's going to be fully healthy for us," O'Halloran said.

The acquisition of Drew and Hanrahan are the latest in a series of moves designed to improve on a 69-93 record and a last-place finish in the AL East. The Red Sox already have obtained right-handers Ryan Dempster and Koji Uehara, outfielders Shane Victorino and Johnny Gomes and catcher David Ross.

Over the past two seasons, Hanrahan had 76 saves, fourth most in the National League, and a 2.24 ERA. Last season, he was 5-2 with a 2.72 ERA and 36 saves.

The six-year veteran will take over the closer's role that Alfredo Aceves struggled in most of last season before giving way to Andrew Bailey, who had missed most of the season with a right thumb injury.

In his first season with Boston, Bailey was 1-1 with a 7.04 ERA and six saves in nine opportunities over 19 games.

Manager John Farrell has talked with Hanrahan and Bailey and told them that Hanrahan will be the closer, although "we see Andrew as playing a very important role," O'Halloran said.

The Red Sox's search for a closer began when Jonathan Papelbon signed as a free agent with the Philadelphia Phillies after the 2011 season.

Hanrahan figured he was part of that quest when he heard his name in trade rumors involving the Red Sox, Detroit Tigers and Los Angeles Dodgers.

"I got excited" when he learned of the trade, Hanrahan said. "Obviously, the Red Sox have a great history and tradition and it's a huge sports city."

In six seasons, 2 1/2 with the Washington Nationals and 3 1/2 with the Pirates, he's 22-17 with a 3.74 ERA and 96 saves in 117 chances. His best season was 2011 when he went 1-4 with a 1.83 ERA, 40 saves in 44 opportunities and just 16 walks in 68 2-3 innings. His control slipped last season when he walked 36 in 59 2-3 innings.

Hanrahan said hamstring and ankle problems affected his pitching mechanics.

"I don't think the walks are going to be a concern," he said. "I feel good going to spring training."

Hanrahan said he's never been to Fenway Park, but O'Halloran doesn't think he'll have trouble adjusting to the American League.

"Joel Hanrahan has the stuff to pitch anywhere," he said.

Holt spent most of last season at Double-A Altoona, then hit .292 in 24 games with the Pirates, all in September.

Melancon was 0-2 with a 6.20 ERA in 41 relief appearances in his only season with Boston. Pimentel spent the season at Double-A Portland. Sands and DeJesus were obtained in a trade that sent Gonzalez, Josh Beckett and Carl Crawford to the Dodgers on Aug. 25.