As the Guardian of the Rock of Eternity, he is one with the Rock as it is a part of him. He channels the energies of the primal God-wave and the Greek Lords of Magic through the Rock of Eternity. As such, he is infused with the duty to keep the power and the magic of the earth realm in balance. As keeper of the Rock of Eternity, he also holds the dark forces at bay. Due to being bound to the Rock of Eternity, Shazam's spirit can leave the Rock of Eternity for short periods of time. It should be noted that Shazam gets weaker the longer he is away from it.
Pre-Crisis, he once claimed to get his powers from his magic mantle which protected him from evil harm and enabled other powers. When it was removed he lost his powers and became just an old man, although it does not appear to work for others, when Sivana put it on he was not protected from Captain Marvel as it only protects the wearer from evil harm. In other stories he is shown as being weaker, being captured even while wearing the mantle, and it is once shown that the brazier being lit will summon him even if he is not in Eternity. He also possessed a device with which he could observe the past, present and future, and can throw lightning bolts from the Rock, which transform the Marvels. In another story it is claimed Shazam's powers come from a Shazamium bracelet which enables him and anybody else wearing it to become ethereal and travel back and forth from the Rock of Eternity. If Shazam has it off for 24 hours he dies.
This is a little misleading. When we are talking about todays Shazam (especially in the New52 timeline), then this person is who we formerly knew as Captain Marvel. However, the parts posted above refer to Shazam, the wizard, not Shazam, Captain Marvel. As such we have a slight name problem with all the Shazams. I would imagine Freddy Freeman still turning into "Captain Marvel Jr", which of course would be a little weird, as there is no Captain Marvel (sr) to derive the name from. Maybe Freddy will also be called Shazam Jr (or King Shazam, as he himself suggested in the New52 timeline?)? Doesn't sound any good. It's a problem I'm not sure DC has solved, yet.