After a protracted, awkward dance that delayed a pairing that seemed inevitable, the New York Yankees and second baseman DJ LeMahieu finally found a pathway to extend their marriage: with a contract that somehow managed to be both a win and a loss for each side.

The six-year, $90 million deal that was reportedly being finalized Friday achieved both sides’ primary mission: cementing a reunion between the 2020 American League East runners-up and the player who clearly was their most valuable player. Although both sides explored other options and there had been signs in recent weeks of a potential split, the deal got done with a little more than a month to go before spring training camps are scheduled to open.

With this deal, both sides also achieved their secondary mission. For LeMahieu, 32, that meant securing a guaranteed figure — $90 million — that represents by far the largest in baseball this offseason (though Trevor Bauer, George Springer or J.T. Realmuto eventually could exceed it) and one that comes close to the $92 million third baseman Josh Donaldson (over four years) received from the Minnesota Twins a year ago. The latter was thought to be LeMahieu’s target at the start of the free agent signing period.

For the Yankees, the secondary mission was keeping LeMahieu’s average annual value — $15 million, as it turns out — low enough to allow room for the addition of a starting pitcher while still keeping their 2021 payroll below the luxury tax threshold of $210 million. The Yankees may have made their move later Friday, when they reportedly agreed to a one-year contract with right-hander Corey Kluber, a two-time AL Cy Young winner. The trendy phrase of this offseason is “financial flexibility,” and the Yankees — despite being on the hook for more than a half a billion dollars to Giancarlo Stanton and Gerrit Cole through 2028 — achieved a measure of it with the LeMahieu deal.

But consider the significant concessions each side had to make to keep the marriage together. LeMahieu, coming off an MVP-caliber season in which he hit .364 with a 1.011 on-base-plus-slugging percentage, receives an average annual salary that probably won’t rank among the top 60 in the game in 2021. It is lower, in fact, than the MLB-wide qualifying offer of $18.9 million that teams could offer their free agents this offseason to stay for another year — and that all but two players rejected.

It is a solid bet LeMahieu could have made more on a per-year basis elsewhere — with the Toronto Blue Jays believed to have been the most aggressive suitor — had he opted for that over the larger guarantee. But it is also possible he encountered a free agent market that had been depressed somewhat by the economic fallout of the coronavirus pandemic.

The Yankees’ concession was related to LeMahieu’s age. He turns 33 in July, which means the team will be paying him an average of $15 million annually through the end of 2026, by which point he will be 38.

Of course, if LeMahieu becomes unproductive in the late stages of his career, the Yankees, with their vast resources, can afford to carry him — particularly at such a relatively low salary. But it is still jarring, in the age of financial flexibility, to see a team overextend in terms of years to sign a player who is soon entering his mid-30s, and it is a safe assumption that, all other things considered, the Yankees would have preferred a shorter deal. Just as LeMahieu chose guaranteed dollars over AAV, the Yankees chose the opposite.

Ultimately, LeMahieu with the Yankees was a marriage both sides wanted to extend. It took them long enough to figure it out, and neither side got everything it wanted, but they ultimately found common ground and worked out a solution. Which, come to think of it, is pretty much the definition of a marriage.