Chelsea boss Jose Mourinho signed off on the deal following talks with club executives and Mata is expected for a medical in Manchester on Thursday.
United chief executive Ed Woodward agreed to break the club's transfer record for Mata as they attempt to salvage their season.
Wave goodbye: Juan Mata is set to join Manchester United after a £37m fee was agreed with Chelsea
Dejected: Moyes will be hoping the capture of Mata will arrest his new side's slide into mediocrity
Bitter pill to swallow: Moyes had to watch as
Sunderland beat his United team on penalties in the Capital One Cup
semi-final at Old Trafford
Glum faces: Manchester United players look on during the unsuccessful penalty shootout against Sunderland
Seven defeats in the Barclays Premier League have left United six points off the pace in the race for fourth place - and Champions League football next season - but Mata's addition will cause a huge stir.
The Spanish playmaker, 25, trained alone in the fitness centre at Cobham on Wednesday as his team-mates prepared for Sunday’s FA Cup tie at Stamford Bridge against Stoke City.
After the Sunderland defeat at Old Trafford, Moyes refused to talk about the Mata deal.
Mourinho had given his players two days off following their 3-1 victory over United in the Barclays Premier League on Sunday.
No Spanish inquisition: The Chelsea squad trained at Cobham and Mata was not present for the session
They returned to training on Wednesday to discover that Mata was ‘90 per cent sure’ that he would be leaving Chelsea, three years after he arrived in a £23.5m deal from Valencia.
He has not played for the club since he was substituted in the 53rd minute of their 3-0 victory at Southampton on New Year’s Day.
Mata was replaced by Oscar when the score was still 0-0 and he ignored Mourinho as he walked off the field at St Mary’s. Mata then kicked a plastic chair in the technical area in frustration and team-mates had to calm him down.
Crucial moment: Chelsea boss Jose Mourinho
substituted Mata in the match against Southampton on January 1 and the
Spaniard has not played for the club since
After the game Mourinho claimed the door was open for any player who wanted to leave and Mata was one of them.
He believes he will be given a fresh start at United and it’s a huge statement of intent by the champions after an indifferent first season under new manager David Moyes.
Mata, who was Chelsea’s player of the year for the past two seasons, will sign a lengthy contract at United when he has completed his medical.
United believe they have signed a world class player and he is expected to make his debut for the club against Cardiff on Tuesday.
Providing Mata passes his medical, he will be free to play his first game in front of 76,000 supporters at Old Trafford.
London calling? Basle forward Mohamed Salah is a target for Chelsea
Striking option: Chelsea are believed to be interested in Atletico Madrid's Brazilian forward Diego Costa
Chelsea may decide to spend the Mata money quickly, and were vying with Liverpool to sign Basle’s Egyptian forward Mohamed Salah on Wednesday night. Chelsea are also keen on Atletico Madrid’s Diego Costa.
While Radamel Falcao at Monaco is still on the Stamford Bridge club’s list, he has suffered a serious knee injury that could rule him out for six months.
Mata is determined to push through the move and Mourinho is understood to have accepted that he wants to leave in search of first-team football.
The midfielder has concerns about his inclusion in Spain’s World Cup squad this summer if he is not playing regularly for his club side and Moyes will give him that opportunity as he starts building a team for the future.