Allardyce has been out of management since being sacked by Blackburn Rovers in December.
“It is an honour to be the new manager of West Ham United,” Allardyce told the club’s official website.
“It is a fantastic club with a great tradition and loyal supporters who deserve to be in the Premier League.
“I can’t wait to begin pre-season training as I am determined to get this club back where it belongs.
“I wouldn’t have taken this job if I didn’t think we could bounce straight back into the Premier League.
“More than that, I wouldn’t have contemplated the job if I didn’t think there was the opportunity to build something substantial at West Ham.”