NATIONAL HARBOR, Md. — The Cuban Missile is returning to the Bronx.

Aroldis Chapman, the Yankees’ top free agent target this offseason, agreed to a five-year, $86-million deal with the Bombers late Wednesday night, sources said.

The contract has a no-trade provision the first three years of the deal, according to one source, and he cannot be traded to a team in California thereafter. There is an opt-out clause after the first three years.

It is the largest contract ever given a reliever, breaking the four-year, $62 million deal Mark Melancon signed Monday with the San Francisco Giants.

The deal won’t become official until the 28-year-old Chapman, who was also heavily sought-after by the Marlins and their owner Jeffrey Loria, passes a physical.

Chapman, whose fastball regularly surpasses 100 mph — and has reached as fast as 105 — posted a 2.01 ERA with 20 saves in 31 appearances with the Yankees last season before being dealt to the Cubs. He saved 16 games for the World Series champions, posting a 1.01 ERA in 28 appearances.

advertisement | advertise on newsday

“I love the organization, they welcomed me with open arms and that’s why I decided to go back. I was hoping I had a chance to go back and it happened,” Chapman told ESPN by phone shortly after agreeing to terms. “Every player dreams of being a Yankee, and if they don’t, it’s because they never got the chance.”

Brian Cashman had offers out to both Chapman and Kenley Jansen, the other top closer on the market, but the Yankees’ GM made clear from the start of the process the former was his first choice.

“The attraction to him is we know he can pitch in New York and he doesn’t have a draft pick attached,” Cashman said earlier in the week. “So then it just comes down to money and term. We’ll compete to a certain level and we’ll see if that’s good enough.”

Yankees videos

In an interview with ESPN Monday, Chapman said he desired a six-year contract but disputed reports he wanted a package worth $100 million.

There was almost no chance the Yankees were going to give Chapman six years, and while $100 million was almost as slim a proposition, managing general partner Hal Steinbrenner gave Cashman a good-sized budget to land Chapman, as evidenced by the deal.

Cashman, who is also looking to bolster his rotation, has remained actively involved on the trade front getting, as is the case annually, plenty of hits on leftfielder Brett Gardner, to name one.

One team interested in Gardner appears to be the Orioles, and though Buck Showalter speculated the Yankees would not trade him within the division, Cashman on Wednesday all but mocked the Baltimore manager for saying so.

“I think I’ve demonstrated that I am not afraid to trade with anybody,” Cashman said. “This is my 20th year as general manager. I’ve made trades with the Mets, I’ve traded with the Red Sox. If I can trade with the Red Sox and the Mets, I can trade with anybody. If it’s in our best interests, it doesn’t matter what the other teams gets, it’s does it makes sense for us? If it happens to be them [the Orioles], I don’t really care.”