However, an Aymeric Laporte header and another goal from Sterling wrapped the game up late on as Pep Guadiola's side marched to their ninth consecutive Premier League victory.
The epic thriller will go down in Premier League history as it featured the most goals in a single match on Boxing Day.
"We just had to control the game," Sterling told the BBC. "At 4-0 up you have to kill the game.
"Leicester have some really good players. They didn't get disheartened and kept going. Credit to them."
De Bruyne opened the scoring for City after five minutes with a fine curling shot into the bottom corner.
City were awarded a penalty eight minutes later after Youri Tielemans brought down Laporte inside the area and Mahrez stepped up to score against his former side.
The hosts grabbed a third moments later when Gundogan finished off a flowing team move while Sterling was fouled in the area and converted another spot kick to make it 4-0 inside 25 minutes.
Leicester responded in the second half and scored three goals in 10 minutes through Maddison, Lookman and Iheanacho to threaten a stunning comeback.
However, Leicester's weaknesses at set-pieces continued as Laporte and Sterling both scored from corners to seal an entertaining Boxing Day win for City.