Brazilian state oil company Petrobras on Friday filed to sell up to $64.5 billion of new stock -- the largest in capital markets history -- sending its stock sharply higher after months of uncertainty that dragged on its share price.

The global stock offer could be expanded to as much as $74.7 billion if underwriters exercise a greenshoe option to sell an additional 564 million shares to meet extraordinary demand as the company raises funds for the world's biggest oil exploration program.

That would easily top the $22.1 billion initial public offering by Agricultural Bank of China <601288.SS> earlier this year, as well as the $36.8 billion share sale by Japanese telecommunications company NTT <9432.T> in 1987.

Despite lingering investor concerns about growing government sway over Petrobras

and the possibility of share dilution, the announcement helped investors regain confidence in a stock that slumped as much as 25 percent this year on uncertainty over the plan.

It's better to have a tragic end than an unending tragedy, said Marcio Macedo, who oversees about $40 million of assets at Humaita Investimentos in Sao Paulo.

Investors may not have liked the way they carried out the deal, but this is a world-class asset. There's no way you can't own it.

Petrobras preferred shares were up 4 percent at 28.71 reais in late afternoon trade, near the stock's high for the day.

The company filed to sell 1.59 billion new preferred shares

and 2.17 billion new common shares

. At Thursday's closing prices, it would raise 67.8 billion reais ($39.2 billion) with the common shares sale and 43.8 billion reais ($25.4 billion) from the preferred shares.

The offer includes a $43 billion state-backed swap of oil for shares in which Petrobras will trade new shares for rights to produce 5 billion barrels of offshore oil.

The company faces skepticism from some investors who have questioned the price of $8.51 per barrel for the reserves to be used in the oil-for-shares swap, considerably higher than the $5 to $6 per barrel that analysts said was fair.

Petrobras expects to begin bookbuilding on Friday and price the share sale on September 23.

The plan has become the financial cornerstone of the company's $224 billion, five-year investment plan meant to turn Brazil into a major oil exporter by tapping crude buried deep under the ocean floor in a region known as the subsalt.

Petrobras ranks fifth in oil and gas production among the world's publicly listed oil companies, according to its own figures, with output of 2.53 million barrels of oil equivalent, an amount nearly equal to that of U.S.-based Chevron .

It expects by 2017 that its output will surpass that of Shell , BP , Exxon Mobil and Chevron, mostly due to new production from the subsalt wells.

INVESTOR INTEREST

Government leaders have also said they plan to boost the state's participation in Petrobras' capital to around 40 percent from near 30 percent, which has left some investors nervous about greater state sway in the company.

Analysts say the large size of the swap of oil for shares with respect to the entire stock sale -- authorized by shareholders for up to $85 billion -- shows the government expects it will be able to pick up a considerable number of shares not purchased by private investors.

The stock offering will be led by Banco Bradesco in coordination with Bank of America Merrill Lynch , Citigroup , Banco Itau , Morgan Stanley , and Banco Santander Brasil. It will also be co-managed by BTG Pactual and Banco do Brasil .

Some investors say the concerns about the government's stake have already been priced in and that the company is still a compelling investment given its unique access to quality oil reserves in a world that is quickly running out of them.

I'm finally seeing a very clear pathway to the completion of this whole process, and that's a huge positive, said Marc Fogassa, a managing partner at Hedgefort Capital Management, which owns Petrobras shares.

Minority shareholder participation in the offering will be crucial since it will bring in much-needed cash for the company to shore up its balance sheet, stretched by heavy borrowing to finance the ambitious offshore plans.

The government has authorized state banks, including development lender BNDES, to purchase stock that minority shareholders do not subscribe.

Oil for the exchange will come from at least six fields in the subsalt region, most of which are adjacent to major offshore discoveries such as Franco and Tupi finds.

(Additional reporting by Elzio Barreto in Sao Paulo; Editing by Todd Benson and Steve Orlofsky)