Eru, the Authority, sent back Gandalf with additional power, knowledge and wisdom.

He was sent by a mere prudent plan of the angelic Valar or governors; but Authority had taken up this plan and enlarged it, at the moment of its failure. 'Naked I was sent back – for a brief time, until my task is done'. Sent back by whom, and whence? Not by the 'gods' whose business is only with this embodied world and its time; for he passed 'out of thought and time'.

Prior to Gandalf's return, he would not have been able to rescue Theoden by breaking Saruman's spell and inspiring and leading the Rohirrim. Nor would he have been able to face down Saruman, as originally Saruman had been the leader of the Istari and hence more powerful than Gandalf.

So Gandalf sacrificed himself, was accepted, and enhanced, and returned. 'Yes, that was the name. I was Gandalf.' Of course, he remains similar in personality and idiosyncrasy, but both his wisdom and power are much greater. When he speaks he commands attention; the old Gandalf could not have dealt so with Theoden, nor with Saruman. He is still under the obligation of concealing his power and of teaching rather than forcing or dominating wills, but where the physical powers of the Enemy are too great for the good will of the opposers to be effective he can act in emergency as an 'angel'

Gandalf's barring of the Witch-King from Minas Tirith is another example. Previously, he merely aided Elrond's flood in keeping the Nazgul from Rivendell. After his return he was able to single-handedly impede the Witch-King.

He alone is left to forbid the entrance of the Lord of Nazgûl to Minas Tirith, when the City has been overthrown and its Gates destroyed

Excerpts from Letter 156.