Holders Manchester City were knocked out of the Carabao Cup after West Ham United won 5-3 on penalties in front of an ecstatic sell-out crowd at London Stadium.
The fourth-round tie had ended goalless after 90 minutes before Said Benrahma scored the decisive spot-kick.
Phil Foden fired his penalty wide to give the Hammers the advantage in the shootout.
It is the first time since 2016 City, who have won the competition for the past four seasons, have been eliminated.
Pep Guardiola made nine changes to his side but City finished the 90 minutes with substitutes Foden, Gabriel Jesus and Jack Grealish on the pitch as they searched for a winner in normal time.
Despite peppering West Ham's goal with 25 attempts, they could not find a breakthrough as the hosts claimed a famous win to advance to Saturday's quarter-final draw.
Nathan Ake should have headed City ahead in the first half before Ilkay Gundogan missed another chance from an angle.
Hammers keeper Alphonse Areola made a fine save to keep out John Stones' close-range header while West Ham's best chance in normal time fell to Tomas Soucek.
Memorable night for Hammers
Not since losing to Manchester United at Old Trafford five years ago have City been beaten in the competition.
West Ham scored all five of their penalties and have now knocked out both Manchester clubs after winning at Old Trafford in the third round.
David Moyes, whose side sit fourth in the Premier League, made eight changes but his side dug deep to frustrate the visitors and have now kept four successive clean sheets.
They created several chances of their own in normal time before penalties from club captain Mark Noble, Jarrod Bowen, Craig Dawson, Aaron Cresswell and substitute Benrahma sent the Hammers through.
More to follow.
Line-ups
West Ham
Formation 4-2-3-1
13Areola
31Johnson15Dawson23Diop3Cresswell
28Soucek16Noble
11Vlasic10Lanzini26Masuaku
7Yarmolenko
13Areola31Johnson15Dawson23Diop3Cresswell28Soucek16Noble11VlasicSubstituted forBenrahmaat 62'minutes10LanziniSubstituted forCoufalat 82'minutes26MasuakuSubstituted forFornalsat 62'minutes7YarmolenkoSubstituted forBowenat 62'minutesSubstitutes
4Zouma5Coufal8Fornals20Bowen22Benrahma35Randolph50Ashby51Chesters75BaptisteMan City
Formation 4-3-3
13Steffen
2Walker5Stones6Aké11Zinchenko
17De Bruyne25Fernandinho8Gündogan
26Mahrez80Palmer7Sterling
13Steffen2WalkerSubstituted forCanceloat 45'minutes5Stones6Aké11Zinchenko17De BruyneSubstituted forGrealishat 83'minutes25Fernandinho8Gündogan26MahrezSubstituted forFodenat 72'minutes80PalmerSubstituted forGabriel Jesusat 76'minutes7SterlingSubstitutes
3Rúben Dias9Gabriel Jesus10Grealish14Laporte16Rodri27Cancelo33Carson47Foden53EdozieLive Text
Match ends, West Ham United 0(5), Manchester City 0(3).
Penalty Shootout ends, West Ham United 0(5), Manchester City 0(3).
Goal! West Ham United 0(5), Manchester City 0(3). Saïd Benrahma (West Ham United) converts the penalty with a right footed shot to the top left corner.
Goal! West Ham United 0(4), Manchester City 0(3). Jack Grealish (Manchester City) converts the penalty with a right footed shot to the top right corner.
Goal! West Ham United 0(4), Manchester City 0(2). Aaron Cresswell (West Ham United) converts the penalty with a left footed shot to the top left corner.
Goal! West Ham United 0(3), Manchester City 0(2). Gabriel Jesus (Manchester City) converts the penalty with a right footed shot to the bottom right corner.
Goal! West Ham United 0(3), Manchester City 0(1). Craig Dawson (West Ham United) converts the penalty with a right footed shot to the top left corner.
Goal! West Ham United 0(2), Manchester City 0(1). João Cancelo (Manchester City) converts the penalty with a right footed shot to the bottom left corner.
Goal! West Ham United 0(2), Manchester City 0. Jarrod Bowen (West Ham United) converts the penalty with a left footed shot to the bottom right corner.
Penalty missed! Bad penalty by Phil Foden (Manchester City) left footed shot is close, but misses to the right. Phil Foden should be disappointed.
Goal! West Ham United 0(1), Manchester City 0. Mark Noble (West Ham United) converts the penalty with a right footed shot to the centre of the goal.
Penalty Shootout begins West Ham United 0, Manchester City 0.
Second Half ends, West Ham United 0, Manchester City 0.
Attempt saved. Raheem Sterling (Manchester City) header from the centre of the box is saved in the top centre of the goal. Assisted by Ilkay Gündogan with a cross.
Attempt blocked. Ilkay Gündogan (Manchester City) right footed shot from outside the box is blocked.
Fernandinho (Manchester City) wins a free kick in the attacking half.
Foul by Pablo Fornals (West Ham United).
Attempt missed. Phil Foden (Manchester City) left footed shot from outside the box is close, but misses to the right.
Attempt blocked. Fernandinho (Manchester City) right footed shot from outside the box is blocked. Assisted by Jack Grealish.
Attempt missed. Tomas Soucek (West Ham United) right footed shot from the centre of the box is high and wide to the right. Assisted by Pablo Fornals.