Ayew, who withdrew from the Black Stars’ trip to Brazzaville recently, was brought on from the bench as a second half-substitute.
Minutes later Ayew doubled the Hammers’ lead when he poked home close rang following an Aaron Cresswell corner kick.
The strike was the Black Stars attacker’s fist for the campaign and he dedicated it to his younger brother, Swansea City forward Jordan Ayew who turned 26 on Monday.
Given the manner of Ayew's withdrawal from the Black Stars' camp recently, his sudden inclusion in the Hammers' match day squad may spark a lot of controversy at the West African country.
Senegalese midfielder Cheikhou Kouyate also featured for West Ham and wasted two glaring chances to score in the first half.
Kouyate’s country man Difra Sakho also featured from the bench as Slaven Bilic’s men recorded their first win of the season.