The midfielder told West Ham's website: "I am very happy, pleased and excited - especially after all the speculation in the transfer window - that I can now put that to rest and sign a new long-term contract.
"In the last few weeks, the way the club is going and the direction that the manager and the board want to go is something I want to follow."
The former Charlton, Chelsea and Newcastle player continued: "By signing my new contract, it says that I want to do this as well.
"It also says a lot about West Ham. There have been a lot of negative things written, saying there was a crisis and all of that.
"This shows that West Ham are in a position to keep their players when others want them and as a player and for the fans, that is a great thing.
"The manager (Gianfranco Zola) showed a real desire to keep me. He sees me as a massive part of the squad and that meant a lot to me, especially when there were things being written everywhere. So I am delighted to sign."
Zola said: "This is great news. Scott is an excellent player and it is good to have him at our service for more years.
"We have a long-term view, and we need time to set up our project and give it a chance to grow.
"The club are sticking to this policy and it is brilliant. It means we are really serious about everything that we have said."
Hammers chief executive Scott Duxbury said: "Scott is a hugely important player and his belief in the club's vision is a fantastic boost for everyone at West Ham.
"He has been tremendous this season, not only with his individual performances but for his example and leadership to the talented youngsters we have coming through.
"Added to the absolute assurances Gianfranco has given fans this week about his long-term commitment, this agreement is a further sign that we can all look forward.
"Today's news underlines that a lot of nonsense has been written and said about this club in recent weeks.
"It is clear that even if external forces try to destabilise us, nothing will stand in the way of our football project and our efforts to bring success to this club and our supporters."