Former boxing world champion Floyd Mayweather will fight UFC champion Conor McGregor in a light-middleweight boxing match in Las Vegas on 26 August.
American Mayweather, 40, posted a video on Twitter confirming the fight details with the message: "It's official."
Irish UFC lightweight champion McGregor, 28, said: "The fight is on."
It is reported each fighter could earn as much as $100m (£78.4m) from the bout, which would be one of the richest in boxing history.
Mayweather, a former five-weight world champion and widely considered the best boxer of his generation, retired unbeaten in 2015 after 49 bouts.
That followed a successful defence of his WBC and WBA welterweight titles, a victory that equalled Rocky Marciano's career record of 49-0.
Mayweather retired for the first time in 2008 after 39 fights.
McGregor, who has never boxed professionally, became the UFC's first dual-division champion in November 2016 and has previously challenged Mayweather to a fight under mixed martial arts rules.
His boxing licence was granted by the California State Athletic Commission in December, allowing him to box in the US state.
UFC president Dana White, who took part in negotiations on behalf of McGregor, told ESPN: "We have been in talks for a while.
"They went smoothly. Floyd Mayweather surrounds himself with smart people and we got the deal done. The impossible deal is now done.
"The reason Conor McGregor's as big as he is is he'll fight anybody, anywhere, any time. He will go after Floyd Mayweather and he will try to knock him out."
Floyd Mayweather tweeted a short video on Wednesday with details of the fight
The biggest pay-per-view fight ever?
White said the fight would take place at the T-Mobile Arena in Las Vegas and would be at 154lbs - light-middleweight, one category up from Mayweather's last bout in September 2015, when he gained a wide points win over compatriot Andre Berto.
When Mayweather defeated Filipino Manny Pacquiao on points in May 2015, the fight set a new American pay-per-view record of 4.6 million buys, and White expects that figure to be beaten.
"It's definitely going to be the biggest fight ever in combat sports history and probably going to be the biggest pay day ever - all sides involved are pretty happy with their deals," he said.
Leonard Ellerbe, chief executive of Mayweather Promotions, added: "There is a different feel from the Pacquiao fight. It is the unknown factor.
"There is not one place I go to with Floyd where he doesn't get asked the question: 'Floyd, are you going to fight Conor McGregor?' All Floyd thinks about is fighting Conor McGregor."
McGregor has won 21 and lost three of his 24 MMA contests, and White said his style would cause problems for Mayweather.
"Floyd Mayweather is 40 years old, he's always had problems with southpaws," added White.
"Conor McGregor is 28 and he is a southpaw. Whenever Conor hits people, they fall. He is 100% positive that he wins this fight, and I stopped doubting him a long time ago."
Boxing might not ever recover - De la Hoya
Speaking last month, boxing legend Oscar de la Hoya said the contest was "a farce" and "a circus" and feared the impact it would have on the sport.
"My interest is in the health of boxing as a whole," said De la Hoya, who won world titles in six different weight categories, in an open letter posted on Facebook.
"Floyd's and Conor's motivation is clear. It's money. In fact, they don't even pretend it's not.
"When the fight ends up being the disaster that is predicted, afterwards neither of them will need [boxing] any more. Floyd will go back to retirement and Conor will go back to the UFC. It's a win-win for them. It's a lose-lose for us.
"If you thought Mayweather/Pacquiao was a black eye for our sport - a match-up between two of the best pound-for-pound fighters that simply didn't deliver - just wait until the best boxer of a generation dismantles someone who has never boxed competitively at any level - amateur or professional.
"Our sport might not ever recover."
Mike Costello, BBC Radio 5 live boxing correspondent
One of boxing's all-time greats will take on a man who hasn't had a single professional boxing contest and it'll become one of the most talked-about sporting events of 2017.
Mayweather is coming out of retirement at the age of 40 for a fight some have dismissed as a farce and a mismatch. McGregor is 12 years younger and the biggest draw in UFC, the most successful and popular brand in mixed martial arts. Insults have been traded for two years - when they first started, nobody believed for a moment this fight would happen.
They both draw huge audiences on pay-per-view TV and the showdown is likely to generate tens of millions of dollars for each man.
It's likely to be televised in the United States by Showtime, a cable network and one of the biggest investors in boxing in recent years. Executives there are saying their digital traffic in the past few weeks is leading them to believe this will be nothing short of a monster event and it's been built by the hype generated by these two masters of the art of hype.
Steve Bunce, BBC Radio 5 live boxing pundit
This will be an absolute mismatch. McGregor is a terrific mixed martial artist, a sensational grappler, sensational at all of these things in five-minute rounds - but what he's absolutely hopeless at - and every now and again we see glimpses of it - is boxing.
That's when you have two feet on the ground, one of your hands is up somewhere near your chin and you are using your other hand as a jab. When he boxes, when he tries to box, whether that's in a gymnasium or a little break in a mixed martial arts fight, he is hopeless.