The 25-year-old — who missed Brazil’s opening 1-1 draw with Switzerland at the World Cup because of an ankle injury — gives United manager Jose Mourinho a powerful-looking midfield, with the Brazilian set to slot in alongside Paul Pogba and Nemanja Matic.
“This is the biggest club in the world and I am delighted to be a part of this amazing team,” Fred told the United website.
“To work with Jose Mourinho, who has won so many trophies in his time as a coach, is an opportunity not to be missed.
“I cannot wait to get started and to meet my new team-mates.
“This is a very exciting time for me with my focus now fully on the World Cup with Brazil.”
Mourinho, who has also signed Portuguese full-back Diogo Dalot from Porto, said Fred would add a missing component to the midfield.
“Fred will complement our other midfielders’ qualities,” said Mourinho.
“His creative brain and passing vision will give us another dimension to our game.”
Mourinho is under pressure for his side — who also finished without any silverware last season — to put up a proper title challenge to neighbours Manchester City.
United finished second in the Premier League behind City but a whopping 19 points behind their fierce rivals.
Despite their highest league finish since Alex Ferguson retired, Mourinho was heavily criticised for adopting cautious tactics in several big games as United were often made to look ponderous in comparison to stylish City’s commitment to attack.
Beating City to the signature of Fred, who was a target for the English champions in January, could prove to be a significant first step.
Fred caught the eye in Shakhtar’s run to the last-16 of the Champions League, where the Ukrainians only lost out on away goals to Roma.
A stunning free-kick in the first leg of that tie was a glimpse of what Fred’s talented left foot can produce.
However, he is far more of a creator than goalscorer as his record of just 15 goals in five years at Shakhtar suggests.
United are in need of midfield reinforcements with Michael Carrick retiring and Marouane Fellaini out of contract.
Mourinho’s task will now be to harness Fred’s passing ability, while also finally getting the best out of Pogba in his third season since an £89 million move from Juventus.
Fred will hope to make the same impact on the Premier League as Brazilian international team-mates Willian and Fernandinho, who also arrived in England via spells with Shakhtar.
Handed his debut by Dunga in 2014, Fred’s international career was disrupted after testing positive for the diuretic hydrochlorothiazide during the 2015 Copa America.
He was banned from international football for a year by South America’s governing body CONMEBOL, but only missed four months for Shakhtar as FIFA did not extend the ban to cover all confederations until February 2016.
Fred did not return to the national team until a 3-0 friendly win over Russia in March.