NBA officials approved the swap Friday afternoon by conference call.
"I developed an unbelievable relationship with Shawn," Heat star guard Dwyane Wade said in Phoenix, where he's part of All-Star weekend. "You're sad to lose a friend on and off the court. At the same time, Shawn and I just had this conversation that it's part of the business and we knew it was a possibility."
Toronto also gets guard Marcus Banks and cash considerations, while Miami will receive forward Jamario Moon and a future first-round draft pick, to come sometime between 2010 and 2015. It's lottery-protected, essentially meaning the first time the Raptors make the playoffs after this season, their first-rounder goes to Miami.
If Miami does not get that first-round pick in 2010, it will get an additional second-round pick that year. The Heat also get a $4.2 million trade exception, which would allow Miami to make a future trade even if the salaries involved don't match.
"This is a win-win for both Toronto and Miami and we wish J.O. and Jamario the best," said Raptors general manager Bryan Colangelo, who is familiar with Marion from his time with the Phoenix Suns.
Miami and Toronto discussed the deal for weeks and, with the trade deadline looming Thursday, decided to move forward. Miami also was linked to trade talk with several other teams, including Phoenix and Sacramento, and perhaps was able to coax the draft pick out of Toronto by waiting so long to make the deal.
The Heat said they called no other teams besides Toronto, but acknowledged fielding calls from others.
Marion - whom Miami acquired just over a year ago from Phoenix for Shaquille O'Neal
- was referred to by both Heat coach Erik Spoelstra and president Pat Riley in recent weeks as the team's "second-best player" behind Wade.
He took a bounce pass from Wade and dunked with 1.1 seconds left Thursday night, lifting Miami to a 95-93 win and sparking the sort of on-court, chest-bumping celebration that's rarely seen in the regular season.
It was his last hurrah, though, with Miami.
Marion was a key part of Miami's 28-24 start to this season, averaging 12 points (third on the team behind Wade and Michael Beasley, who now could replace him in the starting lineup at small forward) and a team-best 8.7 rebounds.
"They're getting a great, great player in Shawn," Riley said.
But Marion wanted a long-term contract, something Miami was not willing to provide.
One of Miami's primary areas of concentration, just like every other team in the NBA, is keeping cap space clear for the summer of 2010, when the likes of Wade, LeBron James, Kobe Bryant, Amare Stoudemire and Chris Bosh can become free agents.
And this trade clears another $4.8 million in cap room for that summer; that's what Banks, who had fallen out of the rotation in Miami, would have been owed in the 2010-11 season.
"It sweeps the table, clears the table, for 2010," Riley said.
Plus, it gets Miami a true center in Jermaine O'Neal. The 30-year-old averaged 13.5 points and seven rebounds for Toronto, but has been slowed by injuries. He's owed nearly $23 million next season, but that money won't affect Miami's free-agent plans for 2010.