The news was announced by Hammers co-owner David Gold via his Twitter account.
"I am delighted to announce that our manager Sam Allardyce has signed a new two year contract," Gold tweeted.
Allardyce's Upton Park future had been in question despite his insistence over the last couple of months that he would be signing a new deal 'very soon' after productive talks with Gold and David Sullivan.
Joint-chairman Gold said: "This is fantastic news for West Ham United. Sam has made a hugely positive impact since joining the club nearly two years ago.
"When you consider the difficult situation he faced when he arrived at the club following our relegation, he quickly set about making his mark and built a new team that ultimately got us promoted back to the Premier League at the first attempt.
"We chose to recruit Sam as we knew he would bring discipline, determination, passion and respect to Chadwell Heath and he has delivered on all fronts.
"The relationships that exist throughout the Club are some of the best I've seen during my 20 years in football. When I visit the training ground, it is obvious to see Sam is respected by the players and David Sullivan, Karren Brady and I all enjoy working with him.
"We can now all look forward to the next few years with optimism and I am already excited about our plans for the 2013/14 season."
Allardyce took charge of West Ham on an initial two-year contract on June 1, 2011, guiding them to promotion from the Championship via the play-offs last season and to Premier League safety this term.