When engineers, analysts, executives and researchers from around the world gathered in Rio this week for a conference on offshore oil drilling technology, they encountered something unfamiliar: optimism.

There is a new feeling of possibility in Brazil's battered oil industry, after an auction of offshore concessions last month drew a record take and raised high hopes for deep-water "presalt" fields that were slated to go up for bids on Oct. 27.

A successful presalt auction will be a concrete sign that Brazil is emerging from recession – and will generate desperately needed cash and good news for the embattled government of Michel Temer.

Story continues below advertisement

"That feeling of optimism is substantiated, there's a lot happening," said Horacio Cuenca, an oil industry analyst in Rio with the research firm Wood Mackenzie. "It's like night and day compared to a year ago, when the government changed, and especially compared to the last auctions in 2015, which were a disaster."

The auction hit a last-minute snag when, late on Thursday, a federal judge in the state of Amazonas granted an injunction blocking it, sought by the leftist Workers' Party on the grounds that it would hand over foreign control to a critical Brazilian resource. Such injunctions are not uncommon here and it is likely to be overturned on appeal as early as Friday.

Two days earlier, President Temer managed to hold on to his job in the face of a second round of criminal charges for corruption, after doling out an estimated 11.7-billion reais ($4.6-billion) in constituency funding and debt forgiveness to members of Congress who voted on whether he should face trial. Mr. Temer's popularity rating hovers around 3 per cent, and he will likely struggle, during his final year in office, to pass a package of unpopular pension cuts and other legislation that international investors were waiting for.

But Brazil's economy appears to be rebounding in spite of the corruption and mismanagement scandals that have surrounded Mr. Temer since he took over 14 months ago, following the impeachment of Dilma Rousseff. The annual inflation rate is now 2.5 per cent, the lowest rate in 19 years. Unemployment is still high – 12.6 per cent in August – but is trending down; there were 34,000 new jobs in September. The benchmark Bovespa stock index hit an all-time high last month.

Story continues below advertisement

A rejuvenated oil industry will help: the sector is responsible for nearly 15 per cent of gross domestic product, and significant changes in regulations by the Temer government have helped entice international players back into this market. An oil turnaround is critical for the state of Rio de Janeiro, in particular, where a significant chunk of the budget comes from oil royalties. The state is bankrupt and has made huge cuts to health, education and public security budgets; schools have been closed by strikes by unpaid teachers, hospitals lack basic drugs and services, and violent crime has increased sharply.

Mr. Temer has eliminated or reduced local-content requirements that obliged international players to build wells, ships, pipeline components and platforms in Brazil, and to partner with the state energy firm Petroleo Brasileiro (Petrobras), with a minimum 30-per-cent stake. The rules were put in place by the Workers' Party government of Ms. Rousseff and her predecessor Luiz Inacio Lula da Silva, in an effort to ensure oil profits benefited ordinary Brazilians. Under the old rules Petrobras – the centre of the giant Lava Jato corruption scandal – was the mandatory operator on presalt fields; now the company has right of first refusal but international firms can bid to operate alone in the presalt fields.

"The change in local-content rules is the key," said Mr. Cuenca. "That's what was stopping everything." Brazil had quickly exceeded local capacity to supply ships and platforms and the backlog was stalling work for years, he said, scaring away the major companies who had cash to invest here and exacerbating a downward economic spiral that sent Brazil into its worst recession in nearly a century.

The Temer government also extended by two decades a preferential customs regime for the oil and gas industry called Repetro. There is some uncertainty among investors about what next year's election may bring – Mr. da Silva currently tops the polls – but that is only serving to spur more investment now, said Mr. Cuenca.

Story continues below advertisement

But Claudia Rabello, who heads the Rio energy consultancy OGE, cautions that while she expects large bids from all the majors in the presalt auction, it is nevertheless too soon to be unreservedly optimistic. The customs and local-content requirements could still be challenged, and the environmental-licensing process is holding up production for years. Most of all, investors want security, she said, and they don't have it, today. "For businesses to have security to invest, the economy, the political and institutional context still need to improve," she said.

Mr. Temer is so weakened by the fight to fend off criminal action – and has had to spend so heavily to buy support in Congress – that he is unlikely to be able to pass more legislation unpopular with a public battered by austerity; inequality has risen sharply here in the past two years, after years of decline.

When the presalt fields were discovered in 2006, oil prices were at record highs, and the discovery seemed to guarantee prosperity for a booming Brazil. But crude prices have fallen to around $55 (U.S.) a barrel, while Brazil entered years of economic and political turmoil. Meanwhile the presalt developed new competition: The U.S. doubled its output from shale, a cheaper, more easily accessed source than Brazil's deep-water fields, while Mexico also opened up to foreign investors. Renewable energy sources have expanded their market share.

And by 2015, Petrobras was embroiled in the Lava Jato scandal that helped bring down Ms. Rousseff and cripple the economy. Used for years as a source of kickbacks to fuel the political system, the company was hobbled by mismanagement and massively in debt, forced to lay off tens of thousands of workers and slash production targets. But Mr. Cuenca said the company has made significant steps to improve its transparency and accounting procedures, and learned significantly from its partnerships with international firms including Royal Dutch Shell PLC and Norway's Statoil ASA.

Story continues below advertisement

On Sept. 27, Exxon Mobil Corp. bet big on Brazil, buying rights to 10 deep-water blocks, six of them to be developed in partnership with Petrobras. The government earned $1.2-billion in initial payments – a record for Brazil. Exxon's big play turned heads – its winning bid was more than five times larger than the next highest – and primed expectations that the company will also make a major offer in the presalt round, the first such auction in more than four years. Competition on Friday is expected to be fierce – there are 12 billion barrels of estimated oil reserves in the eight blocks at auction, worth some $600-billion at current prices.

Oil extraction in the presalt layer – as much as two kilometres below the surface of the Atlantic Ocean – is a costly and risky endeavour. But Mr. Cuenca noted that the presalt fields, while expensive to develop, produce fast "and once they start, they don't stop" – for years or decades – giving them a break-even price of $40 to $50.

Brazil plans seven more bidding rounds after Friday, through 2019.