Hart was under huge pressure after two howlers in City's Champions League defeat by Bayern Munich, with his position as England's No 1 being questioned for the first time.
Pellegrini kept faith in him, and Hart rewarded him with a solid display against Everton, and then two more for England against Montenegro and Poland.
The Chilean feels the international games, having received the full backing of England boss Roy Hodgson, were especially important for the 26-year-old's confidence.
Pellegrini said: "I think both games for him were very, very important. He was in his worst moment before the two international games. I think that he showed that he has the personality to do well even in his worst moments.
"I suppose he will improve in confidence and all of us trust him."
Pellegrini had said before the Everton game that he would have no hesitation dropping Hart if he thought it was the right thing to do.
He, however, stuck with Hart, whose emotional reaction at the final whistle against Everton gave an indication of the tension he had been feeling.
When asked if Hart's fist-pumping had revealed a release of pressure, Pellegrini said: "Yes, because it was a very difficult game for him.
"I am sure that I made the right decision to keep him and Joe showed me it was the best decision.
"It (the reaction) was (for) all together - the fans, the other players and the staff.
"All were very close with him because it was a very difficult moment."
Pellegrini is pleased that Hart, along with a number of his City colleagues, could now be playing in the World Cup in Brazil next summer - because it will benefit the club in their Premier League campaign.
He said: "I think, for the players, it's very important they qualify for the World Cup. I think it's the most important thing in football so all of them that have are very happy.
"And of course they all want to arrive in their best form for the World Cup."
Striker Edin Dzeko was pictured in tears after helping Bosnia qualify for the World Cup for the first time in midweek.
Pellegrini said: "I am happy for him and Bosnia. He's a little bit tired but for Bosnia and for him it's very important.
"I hope we will see the best of him in the rest of the season."