Barca had won 4-0 when the sides met two weeks ago, but although Lionel Messi put them ahead, City stormed back in thrilling fashion as Gundogan scored twice either side of a Kevin De Bruyne free-kick.
It ended Barcelona's run of five successive wins over City and moved Guardiola's side to within two points of Luis Enrique's Group C leaders with two games remaining.
"Our (first) goal here changed everything. Our players realised the bad moment was over," said Guardiola. "Today is a good step. We play against a great team and we compete. Now they will realise, 'Wow, we won against the best team.'"
Guardiola wants 'perfect' City against Barcelona
After the doubts engendered by a recent six-game winless run, this was a resounding validation of Guardiola's principles, City outhustling his old team to give him the first statement win of his nascent tenure.
With Celtic holding Borussia Monchengladbach in the other group game, City can secure a place in the last 16 by winning in Germany on November 23, when Barca go to Celtic needing a point to progress.
"It's a shame that after the error we made for the first goal, from them on we had a bad time," said Barcelona coach Luis Enrique. "We didn't have as much of the ball and City took advantage of our errors."
Guardiola signalled his attacking intent by restoring Sergio Aguero to his starting XI, having left the Argentina striker on the bench for the reverse fixture two weeks ago.
The home side should have been awarded a penalty in the 11th minute after Raheem Sterling appeared to be tripped by Samuel Umtiti, but instead referee Viktor Kassai booked the England forward for diving.
Scrutinised Aguero still following Messi's lead
Sterling was incensed and there was worse to come 10 minutes later as Barca took the lead in devastating style with a move that began with a block from Javier Mascherano inside his own area.
Messi, 15 yards outside the box, sprayed a pass wide to Neymar on the left and the Brazilian drove downfield before squaring to Messi, who neatly tucked away his 90th Champions League goal.
Gundogan fired a shot down Marc-Andre ter Stegen's throat at the other end, but for a brief moment it looked like City were on the verge of being swamped as Neymar, Andre Gomes and Luis Suarez threatened.
City, though, refused to be deterred and their committed pressing game paid off in the 39th minute.
Guardiola hails ‘Special One’ Aguero
Sergi Roberto's overhit square pass from Barca's right was intercepted by Aguero, who played in Sterling, and he brilliantly rolled the ball across the box to give Germany midfielder Gundogan an easy tap-in.
City's tails were up and they almost went ahead two minutes later when Fernandinho's mishit shot eluded the lurking Aguero by inches.
The onslaught continued after the break, Sterling fluffing a chance with a heavy first touch and Aguero lashing wide, before Guardiola's men took the lead in the 51st minute.
Sergio Busquets's foul on David Silva presented City with a shooting opportunity 22 yards from goal and slightly to the left of centre.
De Bruyne administered the sentence, stroking the ball into the top-right corner past the wrong-footed Ter Stegen.
Now it was Barca who were rocking, De Bruyne's free-kick just eluding Nicolas Otamendi, Aguero heading Silva's cross wide and Aleksandar Kolarov narrowly failing to pick out the stretching De Bruyne.
Back came the visitors, Gomes rattling the bar after John Stones's overzealous tackle sent the ball into Suarez's path, but after De Bruyne had curled a shot a fraction wide, City struck again.
De Bruyne was the architect, his exquisite pass inside the full-back finding substitute Jesus Navas, whose cross struck Aguero and fell kindly for Gundogan to kill Barca off for good.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ