SAO PAULO (AP) — Brazil auctioned off the rights to develop deep water oilfields on Friday after the eagerly anticipated bidding was nearly called off by a judicial decision.

The auction marks the first time Brazil will give private and foreign companies the chance to operate pre-salt reserves themselves, part of President Michel Temer's push to increase privatization and attract more international investment. Previously, state-run Petrobras needed to have at least a 30 percent stake.

Temer contends that privatization will help drive down Brazil's state-spending and modernize Latin America's largest economy, boosting growth after the country emerged earlier this year from its deepest recession in decades. Critics say Temer is eroding national assets and selling out to foreign entities for too little.

A judge's decision late Thursday suspended the auction, but the Solicitor General's media office said it won an appeal Friday morning. In the end, the auction got under way about two hours after it was initially scheduled to begin.

Petrobras led consortia that won three of the blocks on offer, while Shell led two and was a member of one of the winning Petrobras-led bids. Norway's Statoil also secured a block, in a consortium that included Exxon Mobil. BP and Total also participated in winning bids. There were no bids for two of the blocks.

Decio Oddone, the director-general of Brazil's National Petroleum Agency, told reporters after the auction that the results "far exceeded our expectations."

"It was good for the government. The government managed to attract lots of interest from foreign companies," said Felipe Maciel, editor-in-chief of E&P Brasil, a news service for the oil and gas sector.

Temer has said the new rules would make the first auction in several years a "historic moment." On Friday he said the sector would generate 500,000 new jobs in the coming years.

"This means more innovation and development for the regions directly benefiting and, naturally, for the whole country," he said in a statement, adding that revenue collected by the federal government would be spent on education and health.

Petrobras, which is restructuring in the wake of a massive corruption scandal, supported the move toward privatization.

But the leftist Workers' Party has contested it and backed a request to stop the auction. The party and others argue that privatization will rob the country of revenue and jobs.

"Fighting against the handing over of pre-salt (reserves) is fighting for the creation of jobs and revenue in Brazil, is guaranteeing the functioning of the national naval, petroleum and gas sectors and is ensuring a better future for our people," Carlos Zarattini, a senior Workers' Party lawmaker, said Thursday.

The pre-salt reserves lie offshore in the Atlantic, more than 1 mile (1.6 kilometers) below the ocean's surface and under another 2.5 miles (4 kilometers) underneath soil and corrosive salt. The depth of the oil and the toughness of the salt beds make it exceptionally difficult and costly to drill, though Maciel said Petrobras has developed technology to address these challenges.

The reserves currently produce more than 1 million barrels per day of oil considered to be very high quality.

The National Petroleum Agency has said it expects development of the eight blocks to generate $36 billion in investments and another $130 billion in royalties, oil profit and taxes.