The Red Sox are in the final stages of wrapping up a two-year deal with David Ortiz that would be worth $26 million and include incentive clauses that could add another $4 million.
All that remains, a source said, is finalizing the contract language.
The deal came together roughly five hours before Ortiz would have entered the free agent market and been eligible to sign with any team. Now he has a deal that could take him through to retirement.
Ortiz, who turns 37 later this month, hit .318 with a 1.026 OPS last season. He had 23 home runs and 60 RBIs despite playing only 90 games because of a strained right Achilles tendon suffered on July 16.
Ortiz said several times during the season that he wanted to stay with the Red Sox. General manager Ben Cherington was amendable to that, saying on Oct. 5 that retaining Ortiz was a priority for the team.
The process was relatively smooth after that, especially when compared to previous years.
The Sox and Ortiz were a few minutes away from what surely would have been a rancorous arbitration hearing last winter before the sides agreed to split the difference and agreed on a one-year contract worth $14.575.
In 2011, Ortiz was seeking a multi-year deal and settled for one year and $12.5 million when the Sox picked up the option on his contract. Ortiz complained about his contract status several times that season, pointing out that the Red Sox had signed Josh Beckett, Carl Crawford and Adrian Gonzalez to multi-year contracts.
The Sox probably would have preferred to keep Ortiz on a year-to-year basis. But the financial flexibility gained by trading Beckett, Crawford and Gonzalez to the Dodgers on Aug. 25 made it easier to give Ortiz the security he was seeking.
In case of a snag, the Red Sox tendered Ortiz a $13.3 million qualifying offer earlier in the afternoon. That would have ensured the team receiving a draft pick had he signed elsewhere.
There was concern that at least one team, the Texas Rangers, would make an attempt to sign Ortiz.
The Red Sox did not make offers to righthanders Aaron Cook, Daisuke Matsuzaka and Vicente Padilla, first baseman James Loney, and outfielders Scott Podsednik and Cody Ross.
Those players remain eligible to sign with the Red Sox.
Ross is clearly the priority among that group. The 31-year-old hit .267 with 22 home runs and 81 RBIs last season after signing a one-year, $3 million deal in January.
The Sox would like Ross to return and he said several times that he enjoyed his first season with the Red Sox despite the team finishing 69-93. But Ross is seeking a deal in the range of three years and $27 million and little progress was made.
See the Globe on Saturday for more on this story.