LONDON (AP)Manchester City trimmed the gap to Premier League leader Arsenal to five points by beating Chelsea 1-0 on Thursday after a double substitution by Pep Guardiola paid off immediately at Stamford Bridge.

Riyad Mahrez and Jack Grealish entered in the 60th minute and combined for the only goal three minutes later, with Mahrez tapping in from close range after a perfectly weighted cross by his fellow winger.

City only came to life in the second half after a curiously passive display before halftime, perhaps brought on by a confusing team selection by Guardiola that saw a number of players deployed in unusual roles.

Known for his overthinking at times, Guardiola accepted after the game he got it wrong. That’s why he took off two full backs – Joao Cancelo and Kyle Walker – at halftime and restored Rodri to center midfield, with the Spaniard having also been in a hybrid role covering central defense, too.

Suddenly, City was all over Chelsea and creating chances, even if top scorer Erling Haaland was largely kept quiet and Kevin De Bruyne shone only fleetingly.

”In the second half, it was miles better in all departments,” said Guardiola, who reserved special praise for halftime sub, the 18-year-old Rico Lewis, because he ”changed the game.”

The goal came after Guardiola’s second double change, though it might have been kept out had Chelsea goalkeeper Kepa Arrizabalaga stretched out to block Grealish’s low cross from the left rather than pull away his arm.

”I felt the keeper was going to get it at one point,” Grealish said, ”though maybe I should be praising my cross!”

City pulled four points clear of third-place Newcastle and closed in on Arsenal, which drew 0-0 at home to Newcastle on Tuesday.

”We don’t focus on the table … there’s a long way to go,” City defender John Stones said. ”In previous years we have gone on long unbeaten runs and we need to do it again.”

Chelsea stayed in 10th place, 19 points off the leaders. Graham Potter’s team is as close to the relegation zone as the top four.

Chelsea lost forwards Raheem Sterling, who joined from City in the offseason, and Christian Pulisic to injuries in the first half. Pierre-Emerick Aubameyang came on for Sterling in the fifth minute and was substituted in the 68th.

Another of the substitutes, Carney Chukwuemeka, struck a shot against the post at the end of the first half.

”When you consider everything, losing Raheem and Christian so early, the lads gave everything,” Potter said. ”It was a spirited performance against a top team, so apart from the result I’m proud of the players.

”It’s tough at the moment, I must admit, and I feel for the boys. We have to stick together. It was disappointing to lose those guys but the players on the pitch and the ones that came in gave everything and that’s all you can ask for.”

The teams meet again in the FA Cup on Sunday, with City hosting on that occasion.

More AP soccer: https://apnews.com/hub/soccer and https://twitter.com/AP-Sports