Manchester United manager Sir Alex Ferguson, left, and Everton manager David Moyes talk at Old Trafford in Manchester, England. Moyes is leaving Everton at the end of the season and will succeed Ferguson at Manchester United.

MANCHESTER, England — Manchester United on Thursday handed David Moyes one of the toughest and most coveted jobs in soccer — succeeding Alex Ferguson as manager of the 20-time English champions.

Moyes is leaving Everton to replace Ferguson, who announced on Wednesday he is retiring after nearly 27 years at Old Trafford.

United said Moyes received a six-year deal and will take charge of the newly crowned Premier League champions on July 1.

“It’s a great honor to be asked to be the next manager of Manchester United,” Moyes said in a statement. “I am delighted that Sir Alex saw fit to recommend me for the job. I have great respect for everything he has done and for the football club.

“I know how hard it will be to follow the best manager ever, but the opportunity to manage Manchester United isn’t something that comes around very often and I’m really looking forward to taking up the post next season.”

The 50-year-old Moyes is replacing the most successful manager in British soccer history. Ferguson produced 13 of United’s 20 English titles and a string of other titles, including three European Cups.

Moyes’ arrival should help ensure a smooth transition between the Scotsmen. The 71-year-old Ferguson remains at United as a director.

“When we discussed the candidates that we felt had the right attributes we unanimously agreed on David Moyes,” Ferguson said. “David is a man of great integrity with a strong work ethic. I’ve admired his work for a long time and approached him as far back as 1998 to discuss the position of assistant manager here.”

The former Celtic player made the switch to management at Preston North End in 1998. His club was promoted to the League Championship two years later.

He joined Everton in 2002 and turned the Merseyside club from a relegation contender into a regular qualifier for European competition. In 2005, he guided the club into the qualifying rounds of the Champions League.

Ferociously ambitious and with a sharp eye for emerging talent, Moyes has kept Everton near the top of the Premier League despite limited money to attract the best players.

“There is no question he has all the qualities we expect of a manager at this club,” Ferguson said.

Manchester United has hired David Moyes to succeed Alex Ferguson as manager of the Premier League champions.

The club said Thursday he has agreed to a six-year deal and will take charge beginning July 1, marking the end of Ferguson’s reign of nearly 27 years at Old Trafford. Ferguson announced his retirement plans Wednesday.

Everton confirmed earlier in the day that Moyes would be leaving and that he met with chairman Bill Kenwright to express his desire to join United.

Moyes has never won a major trophy in his coaching career but should help ensure a smooth transition between Scotsmen at United.

The 50-year-old Moyes has shown loyalty and staying power in his 11 years with Everton — attributes that should suit him well in his next job. United is trying to avoid any radical changes to its structure after Ferguson joins the boardroom when the season ends.