On 25 minutes, City made the breakthrough and it was a familiar goal that West Ham have been conceding all pre-seaso.
Elsewhere, there were big wins for Burnley and Brighton.
"In terms of the result, yes", said Guardiola, who nevertheless said he was unhappy with aspects of the performance.
Manchester City have shown they are capable of thrashing any team on their day, so West Ham need to quickly brush themselves off before Brighton.
City have now won 15 Premier League games in a row.
The visitors led at the break thanks to Gabriel Jesus' opener, but moved through the gears after the break as Sterling scored twice. 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.
Yemen's pro-government coalition fractures as separatists grab control in Aden
The separatists earlier took over the interior minister's house after he was evacuated by coalition forces, officials said. The supporters of the Saudi-supported Mansur Hadi government want one unified country with Hadi as president.
Number 10 cancels staff leave up to Brexit day fuelling election speculation
British Prime Minister Boris Johnson is drawing up plans for a bailout fund to prop up businesses in the event of a no-deal Brexit, The Times reported .
US, China step up war of words over Hong Kong
Ortagus did not name the diplomat, or elaborate further on what kinds of private information or children's details were disclosed. Hong Kong-listed Cathay is 45 per cent owned by Swire Pacific and 22.7 per cent held by Air China, according to Refinitiv Eikon.
"In the first half we were sloppy in our passing".
England captain Kane broke the visitors' hearts with goals in the 86th and 90th minutes. In the second half we were better, we were more calm, we played extra passes. "Thankfully a couple of chances fell to me".
Manchester City will play their first home game of the season next Saturday when they host Tottenham Hotspur. This kind of game we can not be precise in our game. "It's down to us players to perform on the pitch". "After we went 3-0 up the game was over".
Pellegrini's team lost their opening four league fixtures last season before the turnaround started, something they can't afford a repeat of if they are serious about challenging for European spots.
Burnley were also 3-0 winners at Turf Moor as an Ashley Barnes double and Johann Gudmundsson's strike condemned Southampton to a heavy defeat.
Manuel Lanzini may then line up on the left while Felipe Anderson switches wings to try and attack City left-back Oleksandr Zinchenko.
Sheffield United grabbed a late point away to Bournemouth on their return to the top flight, with Billy Sharp cancelling out an earlier Chris Mepham strike to salvage a 1-1 draw for the Blades.