Moyes, who won the LMA manager of the year award three times during his time at Everton, said: "I am delighted to have joined Sunderland. I am relishing the challenge and excited by the opportunity.
"I have taken over a big British club, with a great support and I'm looking forward to working in the Premier League again.
"I look forward to continuing the good work done by Sam."
Moyes' stock fell after he left Everton for Manchester United in 2013. He was axed after less than a year in charge at Old Trafford, while a bid to revive his career in Spain also failed when he was sacked by Real Sociedad during last season.
Sunderland bettingDavis Moyes is 4/1 to lead Sunderland into the top half of the Premier League in the forthcoming season.
Sky Bet also offer 5/2 that the Black Cats are relegated. It's 1/3 they stay up.
Sunderland are 10/11 to finish as the north east's top club - they are up against Middlesbrough and Hull in that market this season.
However, Sunderland chairman Ellis Short says Moyes is the right man for the job - and revealed he had targeted him many times in the past.
"We are absolutely delighted to welcome David Moyes to Sunderland, who was by far and away our first choice," he said.
"He is a man whose football pedigree speaks for itself and is someone I have long admired. I have spoken with him on many occasions and I have always been hugely impressed. He was my number one managerial target for the last five appointments, but his desire to honour existing contracts meant we were not able to bring him to Sunderland previously. To be able to finally welcome him as our manager is fantastic news for the club.
"The fact that David has committed to a four-year deal is a clear demonstration of his belief in what he can achieve here. It is our aim to become a better, stronger and more stable football club and with a manager of David's calibre and experience at the helm, we have a fantastic opportunity to begin looking upwards, rather than downwards every season."
Moyes, 53, will have to get to work quickly with little transfer activity having occurred at the club during the summer following a campaign which saw Sunderland narrowly avoid relegation from the Premier League.
Sunderland, who play a friendly at Rotherham on Saturday where Moyes is expected to be in attendance, open their new season at title favourites Manchester City on August 13.