The win sees the Hammers jump out of the relegation zone while resigning Albion to equal bottom on the table.
Speaking after the game, Moyes said: "It was so important as it could have gone either way. The first half was not good, but the second half was much more like it. We got the reward for keeping at it.
"Our hopes are not to be in the relegation positions, but we are in there. I am told it is the first time the club has come from behind since we moved to the stadium.
When asked about Andy Carroll, Moyes replied: "I don't think any centre half would be able to deal with his jump and header.
"The second goal was good play on the break and the ball was played across goal and Andy scores from a tight angle. If he hadn't scored, I would have said he still played well tonight."