(Adds analyst and CEO comment, data on fuel market share, paragraphs 5-14)
RIO DE JANEIRO, March 15 (Reuters) - Brazilian oil company Petroleo Brasileiro SA posted a deep fourth-quarter loss on Thursday, missing estimates due to a massive payout to shareholders in a class action settlement.
Petrobras, as the state-controlled company is known, posted a net loss of 5.48 billion reais ($1.68 billion), according to a securities filing, down from a 2.51 billion real profit during the same period last year. The average estimate in a Thomson Reuters survey of analysts was for a 294 million reais profit.
Petrobras shares fell 2 percent in Sao Paulo, as the stock retreated from a more than three-year high last week.
Adjusted earnings before interest, taxes, depreciation and amortization (EBITDA) slid 32 percent from a year earlier to 12.986 billion reais in the final three months of the year.
Free cash flow in the quarter was 6.608 billion reais, well below the 14.734 billion reais achieved in the July to September period. Net debt at the world's most indebted oil company was stable from the third to the fourth quarter.
Low cash flow generation "illustrates Petrobras' limited ability to deliver a steeper deleveraging process in a $50-55 per barrel Brent price environment, assuming no further asset divestments," Goldman Sachs said in a client note, describing its view of the results as neutral.
Petrobras narrowed its 12-month net loss to 446 million reais in 2017 from the 14.824 billion hole in 2016, but still posted its fourth straight annual net loss. The world's most indebted oil company said that without the extraordinary expenses, it would have reached a net profit of 7.089 billion reais in the year.
"The class action impacted results, but it was important to eliminate the uncertainty that this could have had on our results...we have worked very hard to solve contingent liabilities," Petrobras Chief Executive Officer Pedro Parente said.
The settlement, announced in January, was a milestone for the oil company as it seeks to emerge from a scandal over a massive corruption scheme, in which Petrobras executives and contractors conspired to inflate prices and bilk the company of billions.
Petrobras has denied wrongdoing. The bribery scheme has entangled two former Brazilian presidents and dozens of the country's corporate executives.
Executives reported on the company's efforts to recover fuel market share. Petrobras's share of the gasoline market slid to 77 percent in February, from 83 percent last year and 90 percent in 2016. However, its share of the diesel market rose slightly to 79 percent from 74 percent last year but remained down from 83 percent in 2016.
In January, Petrobras said it was developing a new gasoline and diesel contract model to improve its relationship with customers and boost sales, but it did not provide details.
($1 = 3.29 reais) (Reporting by Marta Nogueira; Additional reporting by Alexandra Alper and Gram Slattery Editing by Phil Berlowitz and David Gregorio)