Pep Guardiola's side were struggling to break down a resolute Everton defence at Goodison Park until Foden pounced to turn in Bernardo Silva's cross in the 82nd minute.
A below-par City then survived a huge Everton penalty claim when a potential handball in the box by their midfielder Rodri was checked by VAR.
In the end, victory was all that mattered as they held on to move six points ahead of Liverpool who have one game in hand.
City have 66 points from 27 games with Liverpool on 60 with the sides still to play each other at the Etihad in April.
Everton's fifth defeat in six league games leaves them one point above the relegation zone in 17th place.
"The second half was much better for the consequences of the first half," Guardiola said. "Goodison Park for us is always so difficult. Good victory, another step."
Last weekend's surprise home defeat by Tottenham Hotspur, City's first league reverse since October, opened the door slightly for Liverpool after a fourth title in five seasons had begun to look a formality for Guardiola.
And when they found themselves bogged down at Goodison Park with the clock ticking it appeared the initiative was set to pass to Jurgen Klopp's Liverpool.
But when Silva's low cross took a nick off Everton's Mason Holgate and Michael Keane failed to clear the ball, Foden was alert, nipping in to fire past Jordan Pickford who had earlier made a superb double save to keep out Kevin de Bruyne and Silva.
Everton might well feel wronged, however, when they were not awarded a penalty after Rodri mis-judged the bounce of the ball and appeared to control it with his upper arm.
While City celebrated with their relieved fans at the end, the outcome of the title race was put into sharp perspective before kick off when both sets of players showed their support for Ukraine which is facing a Russian military invasion.
Everton's players were draped in Ukraine flags while City's wore T-shirts, saying "No War" on the front.
City's Oleksandr Zinchenko and Everton's Vitaliy Mykolenko, both Ukrainian and both among the substitutes, appeared close to tears as they embraced each other.
"Thank you so much for all the people at Goodison Park. It was so emotional," Guardiola said. "It is not a nice moment for Zinchenko and the Ukrainian people right now. The people from Goodison Park were amazing for this."
It was a subdued City performance in the first half and it took them almost half an hour to have a shot on target when De Bruyne tested Pickford.
But Everton were not just defending deep, they also carried a threat and Jonjoe Kenny sent a shot into the side-netting after a surging run from Allan.
Richarlison also missed an opportunity before the first half and City were more potent after the break.
But they looked like being frustrated until Foden pounced.