City were beaten 2-1 by Shakhtar Donetsk in their final Champions League Group F game in freezing Kharkiv on Wednesday.
The result brought to an end a run of 20 successive victories in all competitions and was their first loss in 29 matches stretching back to April.
With top spot in the group already assured, it mattered little in terms of the Champions League but it was hardly ideal preparation for Sunday’s derby trip to Manchester United.
City boss Guardiola said: “It hurts. It is never nice to lose a game.
“But we have said many times we cannot win all the time, we are going to lose games. Today was the first.
“We needed to lose a game. It will be good for the club, for all of us and the media. People say things when you win a lot and you can forget that now.
“We saw many good things but we made mistakes and we are going to improve on that. Football is how you recover in the good moments and bad moments to stay stable.
“Now we prepare for Sunday and then after that think about Swansea and Tottenham.”
It was with this weekend’s trip to Old Trafford in mind that Guardiola made seven changes. Among those to feature were 17-year-old Phil Foden, making his full debut, and 20-year-old defender Tosin Adarabioyo. Brahim Diaz, 18, also appeared as a second half substitute.
Guardiola said: “We played to win until the end. We did a good performance and young players like Tosin (Adarabioyo), Phil (Foden), Brahim (Diaz) played really well.
“Players like Yaya (Toure) and (Ilkay) Gundogan made a good performance as well and Bernardo (Silva) was brilliant. We created chances. Now it’s about recovery and preparing for the next game.”
Shakhtar’s deserved victory guaranteed their place in the knockout stages, although Napoli’s loss to Feyenoord in Rotterdam meant they would have gone through anyway.
The Ukrainian champions were sharp in attack and struck twice in quick succession midway through the first half through Brazilian pair Bernard and Ismaily. City’s reply was a late consolation penalty from substitute Sergio Aguero.
Shakhtar’s success meant that their coach Paulo Fonseca, who was recently linked with Everton, fulfilled a promise to hold his press conference dressed as the swashbuckling fictional character Zorro.
The Portuguese, wearing a hat and mask, said: “This is the most joyful press conference of my career!”
Reflecting on his side’s performance, he said: “Tonight we played an almost ideal game. We were very disciplined in defence and broke through to attack very effectively.
“It was very important to close up some particular zones for Manchester City where they are usually very dangerous. I think we did that well and they did not threaten as they normally would.
“I feel great joy. I think not only Shakhtar’s supporters but all Ukrainians have to be proud of our team. Twelve points in such a group is fantastic.”