Last Sunday, over 115 million Brazilians cast their ballots and re-elected President Dhilma Rousseff to another four-year term leading the emerging country's government.

Voting is compulsory in the Brazilian political system, which explains the remarkably high voting numbers. Even more remarkable, though, is that Rouseff won Sunday's runoff election by only a scant 3.4 million votes.

The markets reacted to Rousseff's victory with borderline panic. The Brazilian Ibovespa -- the primary Brazilian equities market, a rough equivalent to the the S&P 500 (SNPINDEX:^GSPC) in the U.S. -- is down more than 10% over the past month and dropped more than 2% on Monday after the election.

^BVSP Chart

^BVSP data by YCharts

Brazilian investors' panic isn't totally off base
Since Rousseff first took office, the Brazilian economy has more or less hit a brick wall. The economy has stalled after a decade of double-digit growth. Inflation has spiked to 6.75%, a full 200 basis points above the government's target. The unemployment rate appears low at first glance; however, the labor force is shrinking by over 1% per year as job seekers are giving up their search and relying on government support to subsist.

This election was largely framed on economic arguments. Rouseff's workers' party carried northern states where the nation's welfare programs are most prominent. In the industrial south, though, the opposition leader, Aecio Neves, held sway with a more pro-business platform.

With Rousseff's narrow victory, investors sold equities in anticipation of a continuation of the policies that stalled the economy to begin with. 

When everyone zigs, it's time to consider a zag
Stepping back and looking at the big picture, though, there are several investment opportunities for a savvy contrarian investor.

First, consider the equity markets in general. The Ibovespa currently trades at a mere 10 times earnings. Consider that the S&P 500 is currently trading at 18 times earnings and the Dow Jones Industrial Average (DJINDICES:^DJI) is trading at close to 16 times earnings. 

Brazilian companies are still producing goods, still meeting the needs of the country's businesses and individuals, and still earning profits. With a price-to-earnings ratio quickly dropping into the single digits, this represents a great opportunity to buy some great companies on the cheap. In other words, it's a value investor's dream.

There are several ETFs available for U.S. retail investors to easily gain exposure to the Brazilian market. The largest and most popular is the iShares MSCI Brazil Index Fund (NYSEMKT:EWZ).

Be picky and make sure you understand the specifics
In Brazil, just as in any other major economy, there will be winners and losers as policies change and markets react. The devil is in the details. Brazil's huge oil and gas industry is an excellent example.

Currently, global oil prices are in the middle of a significant slide. Simultaneously, there is a growing scandal inside Brazilian oil giant Petrobras (NYSE:PBR). Taking these things together, it's probably a reasonable idea to avoid investing in Brazilian commodity businesses, and Petrobras specifically, until the current turmoil settles down.

On the other hand, though, a strengthening dollar and continuation of Brazil's existing policies will probably weaken the country's currency, the real. The weakness in the real will help exporters of manufactured goods, as the currency fluctuation will make their products cheaper abroad.

G

Brazil is a land of incredible beauty, and also opportunity.

Further still, instead of writing off Rousseff as anti-business, it's important to look at specific policies and understand what effect they will have on businesses. Brazil's housing subsidy program, "Minha Casa, Minha Vida", is an excellent example.

The program has spent around $50 billion over the past five years to help low-income Brazilian families move into owner-occupied housing projects. The program has been met with some criticism in its execution, but taking the bigger-picture view, this program has facilitated the construction of millions of homes that would not otherwise have been built. 

A Brazilian homebuilder would stand to benefit from this program's continuation, which is expected to be announced in early 2015. Gafisa SA (NYSE:GFA) is one such homebuilder that happens to trade on U.S. markets.

A country with its share of problems, but still a bright future
Brazil, without question, has its fair share of economic problems. The country is caught between a rock and a hard place -- on one side is high inflation, and on the other is low growth. Any policy move to help one side works inversely to harm the other.

But at the same time, Brazil is the fifth most populous country in the world, with a burgeoning middle class still looking to find its place in the world. It's also the sixth largest economy in the world, and despite all the country's problems, the economy does have room to grow substantially over the long term. 

Nothing is ever certain, and Brazil could continue to sputter along, waiting for reforms to unlock the country's huge potential. Investors this week indicated that they think Dhilma Rousseff is not the person to bring those reforms. The truth is that it's too early to tell. But for the long-term investor, the Ibovespa's decline over the past several quarters could be the opportunity to buy low.

Jay Jenkins has no position in any stocks mentioned. The Motley Fool recommends BMW and Nike and owns shares of Nike. Try any of our Foolish newsletter services free for 30 days. We Fools don't all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.