Europe's top stock market in 2012? Greece

athens stock exchange
Who would have guessed it? The Greek stock exchange was the best performer in Europe.

Few would have bet on Greece being Europe's best performing stock market in 2012, but it managed to outstrip Germany's DAX, as international support silenced speculation about an imminent exit from the eurozone.

The ATHEX composite index of Greek shares chalked up gains of 33%, despite a fifth consecutive year of recession, record unemployment and the high-profile defection of Coca-Cola bottler Hellenic from the Athens market.

But Monday's close at 908 points still leaves it more than a third lower than it was two years ago, having fallen 52% in 2011.

This year's rally came as Greece's international partners agreed on a second bailout program, and gave a new government elected in June more time to meet its budget commitments. Strong messages of support from Germany and the European Central Bank helped draw a line through talk of a "Grexit", at least for now.

Related: Merkel warns Europe crisis far from over

Blue-chip shares in Germany, which has carried most of the cost of rescuing Greece and funding Europe's permanent bailout fund, had a banner year. The DAX gained 29%, about twice the gain seen in France and other major European indices.

El-Erian: Five global risks to grasp
El-Erian: Five global risks to grasp

While Germany's economy has felt the impact of slower growth in China, and the recession across the eurozone, it was still able to grow through the first three quarters of the year, and acted as a magnet for equity investors who reduced their exposure to weaker European markets.

The DAX was also bolstered by the performance of stocks such as Volkswagen (VLKAF) and BMW, which benefited from a recovery in global auto sales, and the relatively low exposure to financial sector compared with other leading indices in Europe, including the FTSE 100, which gained only 5.6% this year.

Furthermore, the decline in the value of the euro against most major currencies helped Germany's exporters of industrial and consumer goods.

CNNMoney Sponsors