Troy Deeney gave the hosts the lead from the spot in first half but Ayew, who was playing his first game after the Africa Cup of Nations in Gabon, equalised for the Claret and Blue on 73rd minute.
The former Swansea star replaced Robert Snodgrass in the 66th minute, hitting home a rebound from the post.
"I think in the first-half they got control of the ball. They put us under pressure and we couldn't really play our game. In the second-half, we managed to come out and play how we know how to play," Ayew told his club's website.
"It's a fair result. They had the first-half and we had the second. It was a tough game. This is the premier league, we just need to keep working hard and hopefully we'll get the results we want.
"For the goal, the ball came to me off both posts, and sometimes that's the game and that's how it comes. Sometimes, it doesn't drop for you but that's football.
"For me it was important to score and I'm happy. It's my first game back from the Africa Cup of Nations. I will continue to work hard and hopefully I can get some more goals," he added.
West Ham will host leaders Chelsea next weekend at the London Stadium. The first game against the Blues in August last year was Ayew's debut but the midfielder had a disappointing start as he limped off the pitch after picking up an injury.