Brazilian Gabriel Jesus, preferred by Pep Guardiola to Sergio Aguero in attack, opened the scoring in the 25th minute with a deft close-range finish after a scorching burst and low cross from Kyle Walker.
Sterling made it 2-0, six minutes after the interval, with a cool finish after Kevin De Bruyne had burst from midfield and fed the England forward.
Jesus then became the first player to have a goal disallowed by the Video Assistant Referee (VAR) in the Premier League when, in the 53rd minute, he finished off Sterling’s pass following a fine move.
However, the VAR adjudged that Sterling was marginally offside as he ran into the box.
VAR, making its debut this season, was used again to review and eventually validate Sterling’s second, when he collected a lofted ball into the box and lobbed West Ham keeper Lukasz Fabianski.
The video staff were busy again in the 84th minute when City were awarded a penalty for Issa Diop’s foul on Riyad Mahrez.
Substitute Aguero’s soft penalty was saved but VAR ruled that Declan Rice was encroaching into the box and referee Mike Dean ordered a re-take — which the Argentine scored before Sterling completed his hat-trick in stoppage time.
Last season’s runners-up Liverpool began their campaign with a 4-1 win over Norwich City at Anfield on Friday, but City’s emphatic victory was another sign that we could be in for a repeat neck-and-neck battle between the leading pair.
The result was City’s eighth successive win in competitive matches against West Ham, in which time they have scored 28 goals and conceded four.
Guardiola was pleased with his team’s second half display but had some critical words for their performance in the opening 45 minutes.
“It was difficult away from home, 12:30 kick-off, hot. The first half was not good. We didn’t control second balls and lost a lot of balls,” said the Spaniard.
“It was important to get three points, a clean sheet. At 2-0, they have a chance. Overall for the first game it is an incredible result.
“The second half was much better. More calm, but still we have many things to improve.”
Guardiola said that the VAR decisions were a reminder of the need for a team to keep their cool in what are still unusual situations.
“You have to be mentally strong when VAR is not on your side. You think at 0-3 the game is almost over but at 0-2, the game is completely different.
“You have to be calm and be strong, it is going to change the dynamic not just for the team but for the spectators,” he said.