Back in 1918, Harry Houdini performed one of the greatest illusionary tricks of all time: He made an elephant "disappear" on stage. The ability to hide such a large object in plain sight was quite the accomplishment. Today, investors who are looking at the coal space are probably feeling very similar to Houdini's audience. How, in spite of all the challenges in the coal market, was Alliance Natural Resources (ARLP -0.33%) able to post a record year in both selling and production?

Let's look at what's going on in the coal market and how Alliance made an extra 1.6 million tons of coal disappear from their mines this past quarter.

Coal demand is shrinking, right?
There have been several stories talking about the slow death of coal in the U.S., and some strong numbers provide evidence for it. The Energy Information Agency's most recent report on total energy generation in the U.S. shows that coal generation has dropped by more than 10% from 2002 to 2011, and the numbers through November 2012 suggest an even larger drop.

Source: US EIA, authors calculations.

With U.S. shale gas supplies running high and industrywide fears of EPA regulation, natural gas is making its case to try to usurp king coal as the leading energy generation source in the United States. Duke Energy (DUK 1.51%), which just announced the early retirement of two coal plants, expects to shut down about 6,800 megawatts of coal-fired facilities in the next few years;  but that's just a drop in the bucket. According to an environmental research group, it might be less expensive for Southern (SO 1.10%) to close its 353 coal-fired facilities instead of installing pollution controls.

Coking coal demand in the U.S. hasn't been too kind, either. The most recent estimate shows U.S. consumption of coking at its lowest level since 2010.

US Coal Consumed by the Industrial Sector for Coke Plants Chart

U.S. coal consumed by the industrial sector for coke plants. Data by YCharts.

This follows a big scare back in the fall, when there were fears that a Chinese slowdown would reduce steel consumption and hit metallurgical coal demand hard. Chinese coking coal imports almost halved in August and September, sending shares of Alpha Natural Resoures (NYSE: ANR) and Cliffs Natural Resources (CLF -1.79%), coking-coal-heavy miners, to their lowest levels since 2009.  

Beyond the horizon
Yet despite all this, Alliance was able to post a record quarter and a record year in 2012. How can a company pull this off?

Exports.

That scare over Chinese metallurgical coal imports proved only to be a temporary one, and since last fall, the Chinese government has posted two straight months of record coking coal imports. This doesn't include thermal coal, which steadily rose throughout 2012. China alone is on the verge of surpassing the rest of the world combined in coal consumption.

Source: US EIA.

The upshot of all this is that the U.S. posted its highest-ever export volumes of coal. According to the EIA, the U.S. exported 10 million more short tons of coal than any other previous year, a 9% increase over the record set in 1990. Also keep in mind that this is before factoring in the December export numbers. If foreign demand for U.S. coal remains this high, then perhaps we shouldn't worry too much about the disappearance of the U.S. coal industry anytime soon.

So despite the initial fears for the coal industry, it looks as though there's still plenty of room to run. Alliance's new acquisition, the Onton mine in Kentucky, will provide a nice boost to production while the company brings its new South Gibson project up to speed for 2014. By the looks of it, the company should have no problem finding demand for its product.

What a Fool believes
With political pressure hitting coal-fired power plants, look for companies such as Alliance to rely more on exports as a reliable revenue source. Even though there's been a bit of a slowdown in Chinese economic growth, it's still chugging along at a 7% plus rate.  

If investors are looking at the coal industry, be sure to look at a company that has a high exposure to foreign markets, because it will be the source of demand growth going forward. Companies such as Alliance and Peabody Energy certainly fit the bill as companies that have diversified out into the foreign markets and have secured long-term contracts. If you're one who truly believes in a rebound in the U.S. coal market and wants to captialize, The Motley Fool has written a special new premium report detailing exactly why Peabody Energy is perhaps most worthy of your consideration. Don't miss out on this invaluable resource -- simply click here now to claim your copy today.