(Adds context on gov't finances)
BRASILIA Aug 29 (Reuters) - Brazil posted its third straight primary budget deficit in July, reaffirming market expectations that President Dilma Rousseff will miss a key fiscal goal for the third straight year.
Brazil posted a primary budget deficit of 4.715 billion reais ($2.11 billion) in July, versus market expectations for a slight surplus, central bank data showed on Friday.
The primary budget, which represents the public sector's excess revenue over expenditures before debt payments, had been expected to show a surplus of 200 million reais, according to the median forecast of 11 analysts surveyed by Reuters.
The country's overall budget deficit climbed to 32.711 billion reais in July from 20.792 billion in June. In the last 12 months through July, the overall deficit was equal to 3.84 pct of GDP.
The shrinking fiscal savings has become a hot topic in the presidential race with the main opposition candidates blaming the government of relaxing the fiscal discipline that brought stability to an economy plagued by crises.
Environmentalist Marina Silva who is threatening to unseat Rousseff in a possible run-off vote in October has vowed to control expenditures to regain investors' confidence. Third-placed centrist Aecio Neves has also promised to "put the house in order" and bring transparency to public accounts.
Brazil's public finances have deteriorated rapidly under Rousseff after she gave tax breaks to dozens of industries in an attempt to restart the country's stagnant economy.
Those measures failed to bolster the economy and instead eroded government's revenues, leading Standard & Poor's to cut Brazil's debt rating closer to junk status.
More disappointing fiscal results could threaten Brazil's coveted investment rating, analysts say.
In the first seven months of 2014, the government has been able to meet just 25 percent of its primary surplus target for the whole year. The government pledged to save at least 99 billion reais this year in primary surplus, or 1.9 percent of the country's GDP.
Although the country's net debt is small compared to other major economies, it is no longer declining as it was over the past decade. The country's net debt as a percentage of GDP climbed to 35.1 percent in June from 34.9 percent in June.
The country posted a primary deficit of 2.1 billion reais in June. ($1 = 2.235 Brazilian reais) (Reporting by Alonso Soto; Editing by Jeffrey Benkoe and Chizu Nomiyama)