There was a subdued atmosphere for long periods at Goodison Park as a home victory would do Merseyside rivals Liverpool a massive favour, but Everton needed to win to realistically keep their hopes of UEFA Champions League football alive and they took the lead in the 11th minute when Ross Barkley curled a sublime shot into the top corner.
However, Sergio Aguero beat Tim Howard at his near post to equalise after 22 minutes and Edin Dzeko’s well-directed header from James Milner’s cross made it 2-1 just before half-time.
In a crucial period at the start of the second half, Joe Hart saved brilliantly from Steven Naismith and Dzeko struck City’s third moments later.
Romelu Lukaku headed in midway through the second half to set up a tense finale but City held on to go above Liverpool on goal difference with a couple of home games to follow, whilst also ensuring that Arsenal will finish fourth ahead of Everton.
Everton had looked on course to upset the odds when Leighton Baines and Steven Naismith combined down the left on 11 minutes to tee up Barkley, who hit a sublime first-time shot from 25 yards which flew past Hart and into the top corner.
All the pre-match chatter may have been about Evertonians being quite happy with a visiting win but the way Goodison Park celebrated suggested otherwise.
The game opened up with Yaya Toure curling over after cutting inside on his right foot while Barkley’s dangerous dribble into the penalty area was halted only by a superbly-timed tackle by Vincent Kompany.
All the intimations from Aguero were that he could not continue with an apparent groin problem, but while City were readying his replacement Toure slid through an inviting pass and the Argentine’s predatory instincts took over as he skipped past Antolin Alcaraz to beat Howard all-too easily at his near post.
The outcome of hasty discussions on the touchline was to leave Aguero on but he lasted just five minutes before being replaced by Fernandinho, which actually improved City in a way as it pushed Toure further forward but gave Pellegrini’s side greater dominance in midfield.
Everton switched from their experimental 3-4-2-1 formation to 4-1-4-1 to try to combat the loss of control but whether the changes affected the defence or not Dzeko’s free header for City’s second – after he had almost beaten Howard at his near post again – came far too easily for the Bosnian.
How the hosts wished their own striker was as sharp in front of goal as Lukaku, having not scored in four games, ballooned the last chance of the first half high into the Gwladys Street End.
Barkley remained Everton’s one driving force and a powerful run from halfway just after the break set up Naismith one-on-one with Hart only for the goalkeeper to tip his shot around the post.
It was a pivotal moment as City went straight down the other end and Fernandinho picked out Samir Nasri who crossed for Dzeko to sidefoot home.
Barkley continued to lead the charge, but unfortunately many of his team-mates were not on the same wavelength.
Lukaku seemed so out-of-sorts he appeared to be no threat to City’s defence but he came alive in the last 30 minutes.
He popped up in the 65th minute to head home a Baines cross to make it 3-2, and if Everton needed any more incentive there followed the sight of Toure heading for the bench to be replaced by Aleksandar Kolarov.
Roberto Martinez replaced Phil Jagielka, making his first appearance for 10 weeks, with forward Gerard Deulofeu as they went for the win to keep alive their Champions League hopes but Howard kept them in the game by saving from Pablo Zabaleta.
Deulofeu’s weaving run and shot was deflected into the side-netting and with it went their faint hopes of a top-four finish.