A mistake by goalkeeper Claudio Bravo allowed former City youngster Harry Bunn to fire the Terriers into a surprise early lead at the Etihad Stadium but the hosts roared back with three goals before half-time.
Leroy Sane equalised before an Aguero penalty and Pablo Zabaleta effort put Pep Guardiola’s men firmly in command. Aguero and substitute Kelechi Iheanacho completed the job in the second half.
City will now play Middlesbrough for a place in the semi-finals while Huddersfield, whose manager David Wagner was beginning a two-match touchline ban, can focus on their promotion challenge.
While Wagner made nine changes, Guardiola made clear his determination to progress by naming a strong side. City were soon on the front foot as Sane cracked a shot against a post within four minutes.
But, as seen repeatedly in last week’s exhilarating game against Monaco, City can be vulnerable at the back when sides attack them with pace.
The Terriers did just that and snatched a surprise lead after seven minutes. Philip Billing found space and flicked the ball into the path of Bunn, who took a touch and then lashed a low left-foot shot underneath the slow-to-react Bravo’s body.
It was a horror moment for the much-maligned Chilean goalkeeper on his return to the side after sitting out five of the previous six games.
It was also potentially uncomfortable for Guardiola, who has backed the keeper. He needed his team to respond to take off the heat and, after a subdued spell, they obliged.
As they picked up the pace, they had two penalty appeals for handball rejected, the first being the stronger claim after Jon Stankovic appeared to divert a Kevin De Bruyne cutback.
The equaliser came on the half-hour and City effectively won the game with two more goals in what was a blistering eight-minute spell. Raheem Sterling teed-up Sane for the leveller after some dazzling footwork on the right and there was no doubt about the penalty award that followed after Stankovic bundled over Nicolas Otamendi.
Aguero made no mistake as he rifled the spot-kick into the roof of the net and the Argentinian almost had a second as he hit the woodwork moments later. He went close again as he tested Joel Coleman from close range but quickly adjusted to gather the rebound and set up the third for Zabaleta.
The Bravo incident was not forgotten and the keeper was subjected to a sarcastic round of applause after making a save from Jack Payne before the interval, but City left the field satisfied with their display.
The hosts eased up in the second half and although Joe Lolley went close for the visitors when he headed over, they seemed in little danger.
Aguero put the result beyond any doubt when he neatly swept home his second from six yards from another good Sterling through-ball.
Iheanacho, a late replacement for Aguero, added the fifth from close range in time added on.
Guardiola said: “Even in the moment (when we conceded) we were playing quite good, we made good things against a good team.
“We are happy because we’re in the quarter finals. I was impressed with Huddersfield in both halves - they have good quality players. We missed a lot of the last passes. But OK - we knew how tough it could be and we play in a good performance.
“It’s the best Sergio Aguero ever. Today the performance was amazing. The runs were at the right moment and the right tempo. His performance was top - the same with Claudio (Bravo), his performance with the foot helped us build up.”
Bravo, Zabaleta, Stones, Otamendi, Clichy, Fernandinho, Sterling, De Bruyne (Delph 75), Garcia,Sane (Jesus Navas 81), Aguero (Iheanacho 79).
Coleman, Cranie, Hudson, Stankovic, Holmes-Dennis, Whitehead, Billing (Hogg 67), Lolley (Smith 61), Payne, Bunn (van La Parra 54), Quaner.