Floyd Mayweather will meet Conor McGregor in a fight that has been described as a "farce" and a "circus" but could earn both men as much as $100m (£78.4m).
American Mayweather, 40, posted a video on Twitter confirming the bout will take place in Las Vegas on 26 August, with the message: "It's official."
Irish UFC lightweight champion McGregor, 28, said: "The fight is on."
UFC president Dana White told ESPN: "The impossible deal is now done."
The fight - at light-middleweight - will 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.
White, who took part in negotiations on behalf of McGregor, said: "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 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."