Kelechi Iheanacho's injury-time deflection helped Manchester City return to the top of the Premier League as they beat managerless Swansea.
The hosts, who lost at Stoke a week ago, struggled against the Swans, who sacked ex-boss Garry Monk on Wednesday.
And after Wilfried Bony lost Ashley Williams to score against his former club, Bafetimbi Gomis' late equaliser looked like it would earn a point.
But there was still time for Yaya Toure to curl in off Iheanacho.
The hugely fortunate strike was a severe blow to a rejuvenated Swansea, who were led by caretaker boss Alan Curtis and created the better chances.
Yet after an almost perfect game plan, where Gomis came off the bench late on to end an 11-game goal drought in the league, Swansea slumped to a third consecutive defeat.
The result means the visitors have won one of their last 12 league games and after Bournemouth's win over Manchester United , slip to 16th in the table, a point above the relegation zone.
Relive Manchester City's dramatic win over Swansea
Follow all the reaction to the match
Monk was sacked despite leading Swansea to their highest Premier League finish last season, and former Wales international Curtis said the team felt like they had let down their previous manager, intending to "go a small way to rectifying that" at Etihad Stadium.
After ensuring that Manchester City's Joe Hart was the busier goalkeeper, they succeeded.
With Gomis dropped to the bench and Gylfi Sigurdsson acting as an auxiliary centre-forward forward, this was a performance which combined defensive discipline and the heart that has perhaps been missing in Swansea's recent poor run.
It will certainly give hope to the incoming boss, with AEK Athens manager Gus Poyet among those linked with the job.
The only disappointing aspect from a Swansea point of view was City's first goal, as their normally reliable captain Ashley Williams failed to keep track of Bony's movement from a corner, allowing the Ivorian to score his seventh of the season with an easy header.
Other than that, Lukasz Fabianski was rarely troubled in the Swansea goal with Wayne Routledge and Sigurdsson drawing decent saves from Hart.
The stage was set for a late intervention as Gomis timed his run perfectly to beat Hart at the near post after coming on seven minutes earlier.
However, Swansea could do little to stop the winner as Toure cut in from the right and watched as his left-footed effort went in off Iheanacho's back.
Manchester City will care little about Swansea's plight as they went above previous leaders Leicester, who face Chelsea on Monday, and Arsenal, who visit Aston Villa on Sunday.
Manuel Pellegrini's team now lead the Foxes on goal difference, with the Gunners two points behind.
But after topping their Champions League group with a 4-2 win over Borussia Mochengladbach on Tuesday, City's Chilean boss will be concerned by the lack of verve shown by his side, who did not have much intensity and purpose for long periods.
Kevin de Bruyne, who played in the victory over the Bundesliga side, was dropped to the bench despite some leading performances this season, and it appeared that the hosts missed the Belgian's guile.
David Silva looked like he is still working his way back to full sharpness after an injury lay-off while Raheem Sterling was well shackled by Swansea right-back Angel Rangel.
In the end, Pellegrini will be content to have earned three points, but Manchester City will need to improve for their crucial trip to Arsenal on 21 December.
Manchester City boss Manuel Pellegrini: "I think the three points were very important, more than the way we played. I knew it would be difficult because we had three or four players who couldn't recover from the last game.
"Swansea played very well and it's not the way we want to win. Now we have a week to recover - we have played too many games with 13 or 14 players."
Caretaker boss Alan Curtis: "We certainly deserved to get something out of the game, and when we equalised I thought we were would hang in there. We probably did create more chances than City, that's the difference between the teams at the top of the league and at the bottom.
"We have been struggling with our form, but that's the standard we have to set between now and the end of the season."
Manchester City travel to Arsenal a week on Monday, before hosting Sunderland on Boxing Day and have a trip to Leicester on 29 December. Swansea have two home games to come, against West Ham on 20 December and West Brom six days later.
Full Time Match ends, Manchester City 2, Swansea City 1.
90:00 +4:40 Full timeFull Time Second Half ends, Manchester City 2, Swansea City 1.
90:00 +4:30Attempt saved. Gylfi Sigurdsson (Swansea City) right footed shot from outside the box is saved in the bottom right corner. Assisted by Ashley Williams with a headed pass.
90:00 +4:25Attempt blocked. Angel Rangel (Swansea City) right footed shot from the right side of the box is blocked. Assisted by Modou Barrow.
90:00 +1:20 Goal scoredGoal! Goal! Manchester City 2, Swansea City 1. Yaya Touré (Manchester City) left footed shot from the right side of the box to the top left corner. Assisted by Jesús Navas.
89:19 Goal scoredGoal! Goal! Manchester City 1, Swansea City 1. Bafétimbi Gomis (Swansea City) right footed shot from the right side of the box to the top right corner. Assisted by Federico Fernández with a through ball.
87:52Attempt missed. Bafétimbi Gomis (Swansea City) header from the centre of the box is just a bit too high. Assisted by Jack Cork.
85:59Bacary Sagna (Manchester City) wins a free kick in the defensive half.
85:59Foul by Neil Taylor (Swansea City).
84:42Joe Hart (Manchester City) wins a free kick in the defensive half.
84:42Foul by Bafétimbi Gomis (Swansea City).
83:02 SubstitutionSubstitution Substitution, Manchester City. Kelechi Iheanacho replaces Wilfried Bony.
82:40 SubstitutionSubstitution Substitution, Swansea City. Bafétimbi Gomis replaces André Ayew.
82:10Attempt missed. Nicolás Otamendi (Manchester City) header from the centre of the box misses to the right. Assisted by Kevin De Bruyne with a cross following a corner.
81:31Corner, Manchester City. Conceded by Ki Sung-yueng.
81:29Attempt blocked. Wilfried Bony (Manchester City) right footed shot from outside the box is blocked. Assisted by Yaya Touré.
80:37Foul by Fabian Delph (Manchester City).
80:37Jack Cork (Swansea City) wins a free kick in the attacking half.
78:01Attempt missed. Fabian Delph (Manchester City) right footed shot from outside the box misses to the right. Assisted by Jesús Navas.
77:45Attempt saved. Ki Sung-yueng (Swansea City) header from the centre of the box is saved in the bottom left corner. Assisted by Gylfi Sigurdsson with a cross.
Corner, Swansea City. Conceded by Bacary Sagna.
77:16Attempt blocked. Jack Cork (Swansea City) right footed shot from outside the box is blocked.
76:27 BookingBooking Eliaquim Mangala (Manchester City) is shown the yellow card for a bad foul.
76:18Foul by Eliaquim Mangala (Manchester City).
76:18Modou Barrow (Swansea City) wins a free kick on the right wing.
75:30 SubstitutionSubstitution Substitution, Swansea City. Modou Barrow replaces Wayne Routledge.
74:58 SubstitutionSubstitution Substitution, Swansea City. Jefferson Montero replaces Leon Britton.
74:18Offside, Swansea City. Wayne Routledge tries a through ball, but Jack Cork is caught offside.
73:50Foul by Wilfried Bony (Manchester City).
73:50Leon Britton (Swansea City) wins a free kick in the defensive half.
72:46Attempt missed. Nicolás Otamendi (Manchester City) header from the centre of the box misses to the right. Assisted by Kevin De Bruyne with a cross following a corner.
72:13Corner, Manchester City. Conceded by Wayne Routledge.
72:11Attempt blocked. Yaya Touré (Manchester City) right footed shot from outside the box is blocked.
71:30Hand ball by Gylfi Sigurdsson (Swansea City).
70:40Corner, Manchester City. Conceded by Ashley Williams.
70:15Corner, Manchester City. Conceded by Angel Rangel.
69:33Offside, Manchester City. Gaël Clichy tries a through ball, but Wilfried Bony is caught offside.
68:55Fernandinho (Manchester City) wins a free kick in the attacking half.
68:55Foul by Wayne Routledge (Swansea City).
67:58Foul by Jesús Navas (Manchester City).
67:58Neil Taylor (Swansea City) wins a free kick on the left wing.
67:16 SubstitutionSubstitution Substitution, Manchester City. Kevin De Bruyne replaces David Silva.
66:36Bacary Sagna (Manchester City) wins a free kick on the right wing.
66:36Foul by Wayne Routledge (Swansea City).
65:27Hand ball by André Ayew (Swansea City).
64:04Foul by Yaya Touré (Manchester City).
64:04Leon Britton (Swansea City) wins a free kick on the left wing.
62:38Offside, Swansea City. Wayne Routledge tries a through ball, but Gylfi Sigurdsson is caught offside.
60:17Attempt saved. Gylfi Sigurdsson (Swansea City) right footed shot from outside the box is saved in the centre of the goal.
59:57Delay over. They are ready to continue.
59:14 BookingBooking Bacary Sagna (Manchester City) is shown the yellow card for a bad foul.
58:56Delay in match Wayne Routledge (Swansea City) because of an injury.
58:42Foul by Bacary Sagna (Manchester City).
58:42Wayne Routledge (Swansea City) wins a free kick in the attacking half.
58:28Attempt missed. Federico Fernández (Swansea City) header from the centre of the box misses to the left. Assisted by Gylfi Sigurdsson with a cross following a corner.
57:59Corner, Swansea City. Conceded by Nicolás Otamendi.
57:08 BookingBooking Wilfried Bony (Manchester City) is shown the yellow card for a bad foul.
57:00Foul by Wilfried Bony (Manchester City).
57:00Ki Sung-yueng (Swansea City) wins a free kick in the defensive half.
55:33Offside, Swansea City. Leon Britton tries a through ball, but Angel Rangel is caught offside.
54:44Foul by Yaya Touré (Manchester City).
54:44André Ayew (Swansea City) wins a free kick in the attacking half.
53:52Offside, Swansea City. Jack Cork tries a through ball, but André Ayew is caught offside.
53:20Corner, Swansea City. Conceded by Joe Hart.
53:18Attempt saved. Gylfi Sigurdsson (Swansea City) right footed shot from a difficult angle on the right is saved in the centre of the goal.
52:28Attempt missed. Yaya Touré (Manchester City) right footed shot from the right side of the box is high and wide to the right. Assisted by Fernandinho.
50:34Gaël Clichy (Manchester City) wins a free kick on the left wing.
50:34Foul by André Ayew (Swansea City).
50:12Attempt saved. Yaya Touré (Manchester City) right footed shot from outside the box is saved in the top left corner.
49:12David Silva (Manchester City) wins a free kick in the attacking half.
49:12Foul by Federico Fernández (Swansea City).
48:39Offside, Swansea City. Gylfi Sigurdsson tries a through ball, but André Ayew is caught offside.
48:34Attempt blocked. Gylfi Sigurdsson (Swansea City) right footed shot from the centre of the box is blocked. Assisted by Wayne Routledge.
45:42David Silva (Manchester City) wins a free kick in the defensive half.
45:42Foul by Jack Cork (Swansea City).
45:00Second Half begins Manchester City 1, Swansea City 0.
45:00 SubstitutionSubstitution Substitution, Manchester City. Fabian Delph replaces Raheem Sterling.
45:00 +1:04 Half timeHalf Time First Half ends, Manchester City 1, Swansea City 0.
43:36Delay over. They are ready to continue.
43:19Delay in match Jesús Navas (Manchester City) because of an injury.
42:51 BookingBooking Neil Taylor (Swansea City) is shown the yellow card for a bad foul.
42:41Jesús Navas (Manchester City) wins a free kick on the right wing.
42:41Foul by Neil Taylor (Swansea City).
39:41Wilfried Bony (Manchester City) wins a free kick in the defensive half.
39:41Foul by Neil Taylor (Swansea City).
39:18Attempt saved. Yaya Touré (Manchester City) right footed shot from outside the box is saved in the centre of the goal.
37:58Corner, Swansea City. Conceded by Wilfried Bony.
37:14Foul by Jesús Navas (Manchester City).
37:14Ki Sung-yueng (Swansea City) wins a free kick on the left wing.
35:21Offside, Manchester City. Yaya Touré tries a through ball, but Raheem Sterling is caught offside.
31:56Offside, Swansea City. Neil Taylor tries a through ball, but Wayne Routledge is caught offside.
28:48Nicolás Otamendi (Manchester City) wins a free kick in the defensive half.
28:48Foul by Wayne Routledge (Swansea City).
28:21Attempt missed. André Ayew (Swansea City) header from the centre of the box is just a bit too high. Assisted by Gylfi Sigurdsson with a cross following a set piece situation.
26:58Foul by Gaël Clichy (Manchester City).
26:58Angel Rangel (Swansea City) wins a free kick on the right wing.
25:19 Goal scoredGoal! Goal! Manchester City 1, Swansea City 0. Wilfried Bony (Manchester City) header from the centre of the box to the bottom left corner. Assisted by Jesús Navas with a cross following a corner.
24:43Corner, Manchester City. Conceded by Ashley Williams.
24:41Attempt blocked. Jesús Navas (Manchester City) left footed shot from the right side of the box is blocked. Assisted by David Silva.
22:21Raheem Sterling (Manchester City) wins a free kick on the left wing.
22:21Foul by André Ayew (Swansea City).
19:25Foul by Jesús Navas (Manchester City).
19:25Neil Taylor (Swansea City) wins a free kick in the defensive half.
17:41Offside, Manchester City. Joe Hart tries a through ball, but Wilfried Bony is caught offside.
17:09Foul by Gaël Clichy (Manchester City).
17:09Jack Cork (Swansea City) wins a free kick in the defensive half.
14:43Corner, Swansea City. Conceded by Joe Hart.
14:40Attempt saved. Gylfi Sigurdsson (Swansea City) right footed shot from the centre of the box is saved in the top centre of the goal. Assisted by Wayne Routledge.
13:34Attempt saved. Wilfried Bony (Manchester City) left footed shot from the centre of the box is saved in the bottom left corner. Assisted by David Silva.
6:40Raheem Sterling (Manchester City) wins a free kick on the left wing.
6:40Foul by Angel Rangel (Swansea City).
5:11Yaya Touré (Manchester City) wins a free kick in the defensive half.
5:11Foul by Wayne Routledge (Swansea City).
4:32Attempt saved. Wayne Routledge (Swansea City) right footed shot from the centre of the box is saved in the centre of the goal. Assisted by Jack Cork with a through ball.
3:08Foul by Raheem Sterling (Manchester City).
3:08Jack Cork (Swansea City) wins a free kick in the defensive half.
0:00First Half begins.
0:00Lineups are announced and players are warming up.
Live data and text provided by our data suppliers