MANCHESTER, England — Manchester City kept pace with likely title rivals Manchester United and Chelsea by beating West Ham 3-1 on Sunday for a third straight victory in the early stages of the English Premier League season.

However, what started as a lesson in pass-and-move, attacking football by City under new coach Pep Guardiola turned into a nervy finish at Etihad Stadium.

Raheem Sterling and Fernandinho scored in the opening 18 minutes for City, which carved West Ham open at will in a dominant first-half display that showed Guardiola’s influence is already rubbing off on his players.

Injury-hit West Ham improved in the second half and Michail Antonio’s 58th-minute header made City work for its win, which was sealed by another goal by Sterling in injury time when he rounded the goalkeeper and scored from a narrow angle.

At least one perfect record will go when United plays City at Old Trafford in the first round of games after the international break.

It’s early days, but it could well be a shootout for the title between the three teams already at the top of the standings. City currently is ahead of United and Chelsea on goal difference — and Guardiola said there plenty more to come.

“Of course, there is still room for improvement,” Guardiola said, “but we have been playing well and hopefully we can continue doing that.

“We have to make an amazing performance to win at Old Trafford. I can imagine the atmosphere. I am looking forward to live that experience.”

Arguably Guardiola’s biggest achievement in his first few months at Etihad Stadium is getting the best out of Sterling, who lost his place in the team at the end of last season — his first at City — and then had a poor European Championship campaign with England.

Now, he is showing the kind of form that persuaded City to spend 49 million pounds (then $76 million) to sign him from Liverpool last year. Creating more space for him to run at defenders seems to be the key difference in Sterling this season.

“We try to help him to say, ‘If you stay in that position, you receive the ball quicker,'” Guardiola said. “After, when he receives the ball, it is completely his talent. Man City bought this player because they believe.”

City has won all five of its competitive matches under Guardiola, including two victories over Steaua Bucharest in Champions League qualifying.

In the other game Sunday, Middlesbrough maintained its unbeaten start to life back in the Premier League by drawing 0-0 at West Bromwich Albion in a game of few clear-cut chances.

Middlesbrough has five points from three games.