"I want to thank Fiorentina for the opportunity and the faith they put in me, the directors and fans for the happy moments they gave me," said the midfielder in a statement.
"I hope the supporters can understand that my departure is a positive thing for me and the club. I am certain Fiorentina will be strengthened and that makes me happy."
Melo becomes the 16th Brazilian in the history of Juventus, but is also the most expensive new signing under the current post-Calciopoli administration.
"Playing with the Juventus jersey is a source of pride. I am happy and cannot wait to start wearing the new club colours."
The 26-year-old Confederations Cup star has chosen the Number 4 jersey.