Over the very long term, gold can indeed act as an inflation hedge. But as with any other asset, it matters greatly at what levels you buy it. At the tail end of a giant bull market, gold as any other over-inflated asset does not hedge inflation properly. Indeed, it can even lead to massive nominal losses (never mind the real ones). This can be proved simply by looking at a long-term gold chart (source: the-privateer.com).
As we can clearly see, anyone who bought gold in late 1979/early 1980, spent 20 years taking in nominal losses - not only didn't gold compensate for inflation, it compounded its horrible effects on purchasing power.
This, in a way, reminds me of something that I saw happen while working in fund management. During the 1998 bubble in Portugal, the market was going gaga and, with it becoming so obvious, a decision was made to buy safer stocks. So there isn't anything safer than electric utilities, right? The only problem being, the electric utility we were buying was trading at 30 times earnings. The end result? It hasn't touched the same price ever since (I actually refused myself from executing a buy order over at 5 EUR. I had the trading room chief do it himself).
You might at this point be thinking "but gold is worth … more", which is another way of saying, there is no obvious way to value gold, but you think that it needs to trade higher. However, there really is a way to value gold, and Warren Buffett already did it for us in his latest newsletter (now 6 weeks old, but still perfectly relevant). He did it by comparing it with several (productive) assets (from page 18 onwards). His inescapable conclusion - quite clearly stated and explained - is that the productive assets in question (stocks and farmland) will clearly produce much higher returns over the next few decades. This means these assets are brutally undervalued versus gold, or that gold is brutally overvalued versus them.
So what to hedge with?
If you want to have a hedge for facing the risk of inflation, that is, the risk that stuff will become more expensive, then buy makers of stuff. And how do you buy makers of stuff? You buy stocks. Or, if you don't know which stocks to buy, you buy indexes - which you can do inexpensively by investing In ETFs such as the SPDR S&P 500 (SPY), which obviously tracks the S&P500 or PowerShares QQQ (QQQ), which tracks the Nasdaq 100. Doing this will work better than gold over 5-10-15 years or more. Why? Because gold is currently very expensive just like Warren Buffett showed.
On buying physical gold
An extreme form of gold buggedness says that the only real way to hedge is to buy the gold in physical form. I'll end this by leaving an important warning for those wanting to invest in gold by doing this. Don't do it. The spreads between what you pay to buy coins and what you get if you turn around and try to sell right after are prohibitive. They are usurious. Even gold bars, which are usually the kind of physical gold subject to the tightest spreads, can easily lose you 10%-15% of your investment just on buying and selling the stuff, without the price even moving.
Gold is extremely overvalued and when such happens to a supposedly safe asset, it usually fails to perform its duty as a store of value. Gold has shown as much in the past, and is liable to do exactly the same in the coming years. If inflation protection is what the investor seeks, he should look to buy stocks, in index form if he feels unable to pick them properly.
Finally, buying gold in physical form is even worse, with returns being destroyed by the spreads that are practiced.