For two years, the Yankees moved deftly through an uncharacteristic rebuilding process, establishing a growing nucleus of inexpensive and talented young players that seemed to defy the team’s long-established identity as one of the biggest spenders in baseball.

But always lurking below the surface was the signature desire to bust open the vault and grab the best, and most expensive, player available. And now the Yankees have done just that.

On Saturday, they reverted to form by agreeing to a trade with the Miami Marlins for Giancarlo Stanton, the slugging outfielder and reigning National League most valuable player. Stanton, 28, hit 59 home runs last season, the most in the major leagues since 2001, and he is still guaranteed $295 million through 2028 under the terms of the mammoth 13-year, $325 million deal he signed with the Marlins in 2014.

The deal was confirmed by a person in baseball with knowledge of the transaction, which will not be official until physicals are completed. In exchange for Stanton, the person said, the Yankees will surrender two modest prospects and second baseman Starlin Castro. The Marlins, the person said, will also put about $30 million into the deal to offset some of what the Yankees will owe Stanton.