BOSTON -- Pablo Sandoval and Hanley Ramirez spent the past two seasons as NL West rivals. Now they're teammates, signing with the Boston Red Sox as free agents to try to boost Boston out of the AL East cellar.

"It's exciting for me to be with Hanley and David Ortiz," Sandoval said Tuesday, adding that the trio has already been dubbed the "Three Amigos."

Sandoval's deal -- a five-year pact for $95 million with a $17 million club option for a sixth year (or a $5 million buyout), a major league source told ESPNBoston.com -- was finalized Tuesday morning.

Red Sox Add A Postseason Hero Pablo Sandoval's career postseason batting average of .344 is the best in baseball history among players with at least 150 plate appearances. And he has a .426 batting average in 50 career World Series plate appearances as he helped the Giants win three titles. Player BA Years Pablo Sandoval .344 2010-14 Steve Garvey .338 1974-84 George Brett .337 1976-85 Carlos Beltran .333 2004-13 -- ESPN Stats & Information

The Red Sox announced Ramirez's four-year deal later Tuesday.

"David, he's like my big brother," Ramirez said. "He's texting me pretty much every day and telling me what I've got to do, what I've got to change. I think he's part of my success in the big leagues ... I can't wait to be on the same team with him. It's going to be great."

Sandoval helped the Giants win three championships, earning the World Series MVP in 2012 and the nickname "Kung Fu Panda" that helped cement him as a fan favorite.

"I want a new challenge. I need a new challenge," he said Tuesday during a Fenway Park news conference. "I know that I had a great career in San Francisco. But I'm going to have a new one here."

Sandoval helps fill a hole in the Red Sox's lineup for a third baseman and a left-handed bat. Ramirez, who played shortstop and a little third base with the Marlins and Los Angeles Dodgers, will be the team's left fielder.

"You're always trying to get a sense of where they might fit in," Red Sox manager John Farrell said when asked about potential lineups. "We're not even at Thanksgiving yet. The potential for some other additions might exist."

For now, the Red Sox are overloaded with outfielders and short on pitchers, having acquired Allen Craig and Yoenis Cespedes at the July trade deadline while shipping off four-fifths of the rotation.

"We've got a ways to go in the offseason," Farrell said.

Sandoval's deal includes a team vesting option for 2020. The 28-year-old Venezuelan, who is listed at 5-foot-11 and 248 pounds, was seen as a potential replacement for Ortiz at designated hitter when he retires.

But Sandoval said he will manage his weight to remain in the field.

The Red Sox hope Pablo Sandoval will give them a significant upgrade at third base, a position at which they struggled mightily in 2013. AP Photo/Stephan Savoia

"I'm going to be taking care of those things to play third base," he said.

Sandoval said Ortiz gave him advice when he was in the minor leagues that he has carried with him. Having a chance to play with Ortiz, who was the World Series MVP in 2013, was a factor that attracted him to Boston.

"To be Papi's teammate -- 162 games, all that with him -- for me, it's going to be a very exciting time," said Sandoval, who had dinner with Ramirez on Monday night.

Sandoval is a career .294 hitter who had 16 homers and 73 RBIs in the regular season this year and then hit .366 in the postseason while helping the Giants win their third World Series in five years.

Red Sox general manager Ben Cherington said Sandoval was "a primary target" in the offseason.

"He really embodies a lot of what we care about," Cherington said. "He's been a big winner. He's been a performer when it counts the most. He's respected as a teammate, loves to play. We think he fits what we're all about here. We're excited to have him."

Sandoval also said he was looking forward to playing at Fenway Park, something Cherington feels his bat is suited for.

"His approach, we believe, fits the ballpark well," Cherington said. "Third base had been a position we've been trying to figure out now for a couple of years now. ... This was an opportunity to add a really good player, a great person and a great fit for our team at a position of need."

Last season, Red Sox third basemen ranked 29th in baseball in OPS, with their .580 mark 121 percentage points below the league average of .701.

"He's unique -- a line-drive hitter who has power [and] doesn't strike out," Cherington said. "This is not someone who has to come to Fenway and change anything. He just has to come and be himself and be the best that he knows how to be. If he does that, that's going to help our lineup, that's going to help us win games."

In total, the Red Sox are investing at least $183 million in Sandoval and Ramirez.

Red Sox principal owner John W. Henry was not among those fretting about the risk at stake, with so much guaranteed money on the line.

"I think the risk of doing nothing was much larger,'' said Henry, who attended both ends of the matinee-evening news conferences the Red Sox held to introduce their newest additions. "The risk is avoiding free agency. You can't put together a winning ballclub just through the minor league system. To me that would be really risky.''

Henry was asked about the worst-to-first-worst odyssey the club has been on in the last three seasons.

New Red Sox left fielder Hanley Ramirez called himself "a new player, a new person." AP Photo/Stephan Savoia

"If we can win the World Series every other year and finish last every other year, I'd take that,'' Henry said. "It has been a roller coaster, I can't deny that, but when you have a bad year, like you did this year, just like in 2012, you're determined to rebuild quickly, and I think Ben has taken tremendous steps to do that.''

Ramirez's deal is worth $88 million and includes a fifth-year vesting option for an additional $22 million, according to a source.

Ramirez will be paid a $3 million signing bonus, and $19 million in the first season of the deal and $22 million in each successive year.

"There's just not that many opportunities in this game to bring in a player of Hanley's ability overall, particularly on the offensive side," Cherington said. "He's a very good base runner also. When those opportunities come up you have to avoid being too stubborn about what the rest of the picture looks like."

Ramirez came up in the Red Sox's system before he was traded to the Florida Marlins in the deal that brought Josh Beckett and future World Series MVP Mike Lowell to Boston. The 30-year-old batted .300 with 13 homers and 71 RBIs for Los Angeles this year.

"It's been a while," Ramirez said. "I remember '05 when I got traded I was really upset. Like he said, it worked out for both of us -- you guys won a couple of world championships. I haven't won any but that's what I'm here for. I'm a new player, I'm a new person."

To clear roster spots for Sandoval and Ramirez, the Red Sox designated first baseman-catcher Ryan Lavarnway and infielder Juan Francisco for assignment.

"So now we're in a position where we feel very good about the depth of our lineup, the mix of offensive players that we believe we'll be in a position to address the rest of the team, particularly the pitching staff, the rest of the offseason," Cherington said.

ESPNBoston.com's Gordon Edes and Kyle Brasseur and The Associated Press contributed to this report.