Brazil & Argentina: World's best stock markets

Brazil's middle class feels pain of recession
Brazil's middle class feels pain of recession

Brazil has a terrible economy...but its stock market is one of the world's best this year.

A comeback in commodities prices and a new round of corruption busters are driving Brazil's stock market rally. Its market index, Bovespa, is up 14.1% so far this year in dollar terms, second only to its neighbor, Argentina, which is up 14.7% so far in 2016.

Stocks can be a leading indicator of how investors feel about a country's economic future. But Brazil is the latest example of the dichotomy between the stock market and the economy, which are currently going in totally different directions.

Brazil isn't alone either: Stocks in other struggling economies, like Russia and South Africa, are up this year too.

Brazil's rally is extra special. It's suffering through its worst recession in 25 years, sparked by a corruption scandal at the government-run oil company, Petrobras.

The scandal heated up big time on Friday when Brazilian police detained the wildly popularly former President Luiz Inacio Lula da Silva for his ties to bribery allegations in the Petrobras case. Lula, as he is widely known, remains an iconic figure among many in Brazil's poor and working classes. (Police let him go after a few hours of questioning).

Related: Police detain Brazil's former president

The nation was shocked. But right after police announced they had arrested the former president, Brazilian stocks skyrocketed up on Friday, rallying 7%. Its currency, the real, gained almost 3% against the dollar, a huge one-day leap for a currency.

The police's action also seemed to represent hope that the massive corruption scandal is heading towards some sort of a denouement.

Related: Brazil dives deeper into recession

After all, investors really want one thing: impeachment of the current president Dilma Rousseff, who was Lula's favorite to succeed him. Investors' hope is that Rousseff would eventually be replaced by a president with more market-friendly policies.

As for Argentina, the world's best stock market, its rally is fueled by the end of a debt battle with American bondholders, which will pave the way for Argentina's re-entry into the global capital markets after 15 years.

There's also a huge amount of optimism riding on its new president, Mauricio Macri, who is rewriting the country's economic playbook. Investors are hopeful that Macri's team will turn Argentina's stagnant economy in the right direction.

Related: China's power play right under U.S.: Latin America

A key reason behind the struggling economies of Brazil, Argentina and others is the nosedive of commodity prices over the last two years. Many developing countries depend on exporting commodities like oil, iron, soy and coffee to grow their economies.

But more recently, commodities are rebounding. Oil prices are way up since hitting bottom in mid February. And on Monday, iron ore prices are up 16%. Even soybean prices are up a bit so far this year.

The commodity rebound is driving the rally across many emerging markets. Russia's stock market is up 7.8%, South Africa's index is up nearly 4% and Mexico's stock exchange has gained 4.6%. That's much better than U.S. markets: the S&P 500 is down 2.5% this year.

Will stocks in Brazil and other countries keep rallying? It all depends on where commodity prices go, and in Brazil's case, how fast or slow the impeachment of Rousseff goes.

CNNMoney Sponsors