What happened

Brazilian oil giant Petroleo Brasileiro (Petrobras) (PBR 0.26%) saw its stock surge 8.9% in Tuesday trading, while its preferred "A-shares" -- Petroleo Brasileiro (PBR.A 0.73%) -- did even better, closing up 10.2%.

Shares of Brazilian electric utility Companhia Energetica de Minas Gerais (CIG 0.83%) gained 9.4% on the day.

Companhia de Saneamento Basico do Estado de Sao Paulo (SBS 2.51%), a Brazilian wastewater treatment company, closed 9.6% higher.

What do these three companies have in common? They're all based in Brazil, naturally -- and they're all benefiting from positive sentiment about the upcoming Brazilian presidential election.

Magnifying glass over map of Brazil.

With an election looming, investors are giving Brazil a closer look. Image source: Getty Images.

So what

On Sunday, Oct. 7, Brazil will hold the first round of voting for its new president. At least eight different candidates are competing for the post, but the two leading candidates today are former paratrooper Jair Bolsonaro from the conservative Social Liberal Party and Fernando Haddad from the more liberal Workers' Party. As the two most likely top vote getters in Round 1, these two candidates are expected to face off in a second round of voting on Oct. 28.

That's where today's news comes in. A new poll released by Brazilian media company Ibope Monday showed Bolsonaro, who suffered an assassination attempt earlier this year, closing the gap with his rival Haddad -- who, up to last week, had been leading in the polls for likely second-round voting. As of this week, the two candidates appear to be tied, which, according to analysts at Goldman Sachs, should be good news for business (and stocks), because Bolsonaro is believed to support more market-friendly moves such as deregulation and balanced budgets than is his opponent.

Now what

I see two risks here, however. First, polls can be wrong. Investors hanging their hopes on the results of just one poll -- and one saying Bolsonaro has only tied his opponent and not that he's moved into the lead, no less -- are at risk of being disappointed if voters end up voting differently than they told pollsters they would.

Second, most of the attention here is being focused on the likely results of a second round of voting that is still four weeks away -- before the first round has even been conducted. Until investors know for certain who the runoff candidates will be, it might be unwise to place bets on one of two unknowns beating a second unknown.

If you absolutely, positively have to place a bet, though ... my advice would be to focus your examination on Companhia de Saneamento Basico do Estado de Sao Paulo. Its P/E ratio is the lowest of the three stocks that leapt today -- a mere 7.3 times earnings even after the pop. Also, one thing's for certain: Regardless of who wins the election in October, people in Brazil are going to continue drinking water. Seems to me that makes Companhia de Saneamento Basico a safe stock to bet on.