(Adds context, details on debt/GDP)
BRASILIA, July 31 (Reuters) - Brazil posted a much wider-than-expected primary budget deficit of 9.323 billion reais ($2.78 billion) for June, central bank data showed on Friday, as public accounts continue to suffer under a weakening economy.
The primary budget had been expected to show a deficit of 2 billion reais, according to the median forecast of 15 analysts surveyed by Reuters.
A sharp drop in tax revenues as the economy contracts prompted the government last week to cut the public sector's primary surplus targets sharply for this year and the next two. The new targets sparked a selloff of Brazilian assets and led Standard & Poor's to warn the country could lose its investment-grade rating next year.
The government cut its consolidated primary surplus goal for this year to 8.7 billion reais ($2.70 billion), or 0.15 percent of gross domestic product, from 66.3 billion reais, the equivalent of 1.1 percent of GDP, originally budgeted. It reduced the goals to 0.7 percent of GDP from 2 percent for 2016 and to 1.3 percent from 2 percent for 2017.
Finance Minister Joaquim Levy said the lower targets did not mean the government has abandoned its fiscal discipline after years of heavy public spending that eroded the fiscal accounts.
The Brazilian economy is expected to contract nearly 2 percent this year due to plunging business confidence and softening commodity prices.
In the 12 months through June, the primary budget deficit widened to an equivalent to 0.80 percent of gross domestic product from 0.68 percent in the year ended in May.
Brazil's net debt jumped nearly one percentage point to 34.5 percent of GDP in June, with gross debt rising to 63 percent from 62.5 percent.
$1 = 3.35 Brazilian reais Reporting by Alonso Soto and Marcela Ayres; Editing by Lisa Von Ahn