(Adds details on results, reasons for profit decline)
RIO DE JANEIRO, Aug 8 (Reuters) - Profit at Brazilian state-run oil company Petrobras slumped 20 percent in the second quarter from a year earlier, the company said on Friday, as rising fuel imports, debt costs and operating expenses offset higher output and prices.
Net income at Petroleo Brasileiro SA, as the company is formally known, fell to 4.96 billion reais ($2.18 billion) in the three months ending June 30. That compares with 6.20 billion reais a year earlier.
The profit was nearly a third below the 7.04 billion-real average estimate of 10 analysts surveyed by Reuters.
Profit fell 8 percent compared with the first quarter.
The results reflected a tightening squeeze at Petrobras caused by the conflicting economic policy goals of its controlling shareholder, the Brazilian government.
A drive to develop giant, new offshore oil and gas resources has Petrobras spending $221 billion over five years on expansion, one of the world's largest corporate investment plans.
At the same time, the government has reduced the amount of cash the company has available to pay for those investments by forcing it to subsidize domestic gasoline and diesel fuel. The controls are aimed at helping the government control inflation.
With Petrobras's refineries unable to meet domestic demand, refining unit losses have soared as it is forced to import gasoline and diesel to make up the shortfall.
Domestic fuel price hikes allowed by the government failed to keep pace with the cost of imports.
Net imports of fuel and oil rose 81 percent compared with a year earlier, to 633,000 barrels a day in the three months ending June 30. This contributed to a loss at the refining and supply unit, of 3.88 billion reais.
Crude oil and natural gas production rose 1.7 percent from a year earlier, as new areas barely made up for declining older fields. Expensive offshore projects are months or years behind schedule, eating up more investment capital. As cash is squeezed, debt has had to rise to meet the company's investment goals.
As a result, Petrobras has become the most-indebted and least-profitable of the world's 15 largest oil companies by market value, according to Thomson Reuters data.
Free cash slipped 8.8 percent to 66.36 billion reais in the quarter. Total debt jumped 15 percent since the end of 2013 to 308 billion reais ($140 billion). Higher levels of debt also boosted financial costs, the company said in the statement.
Net sales, or total sales minus sales taxes, rose 12 percent to 82.3 billion reais, a number in line with analysts' expectations as crude prices rose.
Higher operating costs reduced adjusted earnings before interest, taxes, depreciation and amortization by 10 percent from a year earlier to 16.2 billion reais. Analysts had expected 17.2 billion reais.
($1 = 2.28 Brazilian reais)
(Additional reporting by Stephen Eisenhammer; Editing by Gunna Dickson and Leslie Adler)