The 99-year lease was announced by the London Legacy Development Corporation (LLDC) along with details of the revamped stadium.
The Stratford venue will be transformed into a 54,000-seater stadium set to cost £150m, and the Hammers are expected to move in from August 2016.
Negotiations between the LLDC and West Ham have been long and tortuous since the club was named the preferred bidder in December, but with an agreement finally reached, West Ham have been given the right to use the stadium for all their matches under a 99-year deal, giving the club long-term security.
The deal will protect public interest should West Ham's owners sell the club for a large profit on the back of the move to the stadium, with the LLDC guaranteed a significant cut.
The stadium itself will have retractable seats, allowing the 2017 World Athletics Championships to take place as planned.
In addition, the deal opens the way for the stadium to be used as a venue for the 2015 Rugby World Cup.
The plans for the future of West Ham's current Upton Park home and the surrounding area remain confidential.
West Ham joint-chairman David Gold said: "This is very exciting, I'm thrilled that we've signed this deal today. There's a new exciting future for West Ham United FC.
"It will generate jobs when the stadium is renovated, then jobs for the future ongoing."
Joint-chairman David Sullivan added: "We really feel privileged to be going into this stadium. We've had 13 sell-out games in a row and we need a bigger stadium.
"We want football to be affordable for the working class man and that's why we want a bigger stadium.
"This is a win-win situation for London, for the legacy and for West Ham United Football Club."
London mayor Boris Johnson said: "This Olympic Stadium will now be the home of a great London football club, that gave us Bobby Moore and Geoff Hurst.
"The deal is great for West Ham, for London, for football. We're moving the seats, we're moving the roof but we're keeping London's great Olympic Stadium."
West Ham vice-chairman Karren Brady added: "When you come to this stadium at the start of 2016 it will look and feel like West Ham's ground. It will look and feel like a football stadium."
@ Northbank & Tokyo, we only "bid" for it as a bargaining chip, Northumberland park development was already on the table, check out the grants we were after and then recieved, after the bid went in. Mr Levy= shrewd operator, just wish he would be as shrewd about buying a Striker!!!!!- spurs57