City came from behind to win through Ilkay Gundogan's brace and a Kevin De Bruyne free-kick.
Beaten 4-0 at Camp Nou two weeks ago, City fell behind to Lionel Messi's 21st-minute goal, but roared back to win through Ilkay Gundogan's brace and a Kevin De Bruyne free-kick.
Barcelona had won all five of the previous meetings between the teams, knocking City out of the Champions League in 2013-14 and 2014-15.
"They had an amazing 30 minutes. We had a lot of problems, but our first goal helped us a lot," said Guardiola, who led Barcelona to 14 major trophies between 2008 and 2012.
"In the second half we created a lot of counter-attacks. I am so happy for the guys. It is the first time we have beaten the best team in the world."
Messi put Barca ahead at the conclusion of a sweeping one-two with Neymar, but an error from right-back Sergi Roberto allowed Raheem Sterling to set up Gundogan for City's 39th-minute equaliser.
De Bruyne's free-kick and Gundogan's second goal completed the victory and beaten manager Luis Enrique said his side had never recovered their composure after allowing City back into the game.
"The first few minutes we played really well. It's a shame that after the error we made for the first goal, from them on we had a bad time," he said, after seeing City trim his side's Group C lead to two points.
"When you concede a goal like that, it's normal that you go through a bad period after that. In the second half we hoped to continue dominating the game, but it couldn't be.
"Obviously that's because of our errors and the pressure from our opponents also. We didn't have as much of the ball and City took advantage of our errors.
"They have top-quality players and we couldn't control the game in the same way. The result reflects that."
Germany international Gundogan, who also scored twice in last Saturday's 4-0 win at West Bromwich Albion, summed up the delight in the City changing room.
"We started a bit nervously, but after we scored we had our confidence back and the second half was incredible," said the former Borussia Dortmund midfielder.
"We dominated Barcelona."