The England star struck a sublime second-half treble after Gabriel Jesus prodded the champions ahead in the 25th minute of a one-sided affair at the London Stadium.
Sterling's well-worked first goal came six minutes after the interval and though a VAR review found he was offside before Jesus tapped in.
Gabriel Jesus thought he had his second of the day, but VAR rules offside! pic.twitter.com/DdE1mTj3KB— NBC Sports Soccer (@NBCSportsSoccer) August 10, 2019
The England find the net again 15 minutes from time to put City beyond the Hammers' reach.
He could have added the third from the spot after Issa Diop fouled Riyad Mahrez but gifted the spot-kick to Sergio Aguero, which the substitute converted on a re-take, awarded following another VAR intervention.
Sterling was not to be denied the match ball, though, as he raced clean through in added time to compound an embarrassing eighth straight defeat for West Ham in competitive meetings with Pep Guardiola's men.