J.D. Martinez and the Boston Red Sox have, at long last, come to an agreement.

The slow dance between the free agent slugger and the power-deficient team wrapped up Monday when they settled on a $110 million, five-year contract.

A person familiar with the negotiations told The Associated Press about the deal, speaking on condition of anonymity because it was subject to a successful physical and had not been announced. Martinez has the right to opt out of the contract early and become a free agent again.

Speculation Martinez and the AL East champions would eventually wind up together had been swirling ever since he became a free agent last November.

Boston was seeking to add power to a lineup that hit an AL-low 168 home runs. The 30-year-old Martinez has changed his swing to improve his launch angle and become one of the top home-run threats in the majors.

The move helps the Red Sox counter the huge deal their biggest rivals pulled off in December. The New York Yankees, who finished two games behind Boston in the division last year, acquired NL MVP Giancarlo Stanton — who led the majors with 59 home runs — in a trade with Miami.

Martinez hit .303 with 45 homers and 104 RBIs last year for Detroit and Arizona, which acquired him on July 18 for three prospects. He had 29 homers and 65 RBIs in 62 games with the Diamondbacks, and hit a record-tying four home runs in a game.

Martinez started a combined 112 games in right field last year. He figures to become the primary designated hitter for the AL East champion Red Sox, which would turn Hanley Ramirez into a platoon player at first with Mitch Moreland.

The righty-swinging Martinez, who began his big league career with Houston in 2011, has played only seven career games at Fenway Park, batting .444 (12 for 27) without an RBI. He figures to knock in plenty of runs when he takes aim at the Green Monster in left.

Martinez was among several prominent free agents still available over the weekend. Eric Hosmer is in the process of finalizing a $144 million, eight-year deal with San Diego while third baseman Mike Moustakas and pitchers Jake Arrieta and Alex Cobb are among the stars looking for places to play.