The Latics had gone six games without a Barclays Premier League victory, losing four times, but goals from Ivan Ramis and James McArthur early in each half proved enough.
West Ham went into the match on the fringe of the top four but were poor all afternoon and James Tomkins' injury-time header came far too late to make any difference.
Manager Martinez said: "Before the game we knew it was a must-win game, and that's always difficult to cope with. It brings extra expectations and all of a sudden you start wanting to win and you don't really know how to win.
"I thought today was the complete opposite. I thought the performance was very mature, we kept the ball really well at times, we were a real threat and probably the most pleasing aspect was the manner we coped with their attacking threat.
"Until the last minute we showed real composure and I was extremely pleased with that. It was a very well deserved three points and now is probably the start of our season."