Gundogan, in front of the watching Germany boss Joachim Low, curled home a stunning fourth after good work from Aguero.
The hosts – who beat Manchester United earlier this season – knew their race was run.
BASEL (3-4-3): Vaclik; Xhaka, Lacroix, Suchy; Lang, Frei, Serey Die, Riveros; Elyounoussi, Oberlin, Stocker. Subs: Salvi, Zuffi , van Wolfswinkel, Ajeti, Manzambi, Petretta, Bua.
MAN CITY (4-3-3): Ederson; Walker, Kompany, Otamendi, Delph; De Bruyne, Fernandinho, Gundogan; B Silva, Sterling, Aguero. Subs: Bravo, Danilo, Stones, Laporte, Sane, Silva, Foden.
Referee: J Eriksson (Sweden).