(Adds data, analyst comment and context)
BRASILIA, May 29 (Reuters) - Brazil's primary budget surplus rose sharply in April from the previous month, central bank data showed on Friday but was insufficient to erase its year-long deficit.
Brazil posted a primary budget surplus of 13.445 billion reais ($4.25 billion) in April, above market expectations of 10.5 billion reais, according to median forecast of nine analysts surveyed by Reuters. In March, the country had a surplus of just 239 billion reais.
The primary surplus shows how much money is left over to pay interest on the country's public sector debt and is closely watched as Brazil scrambles to retain its investment grade from Wall Street credit rating firms.
A clamp down in public spending, a seasonal increase in tax revenues and strong savings from state governments helped fatten the surplus in April.
Still, the primary budget balance in the 12 months through April was a deficit equivalent to 0.76 percent of gross domestic product, the biggest gap since records began in 2001.
Soon after beginning her second term in office, left-leaning President Dilma Rousseff hired a known fiscal hawk, Joaquim Levy, to command the finance ministry to turn around government finances with tax increases and hefty spending cuts.
On Friday, the government reported the economy contracted 0.2 percent in the first quarter from the preceding three months, partly reflecting the impact of falling government spending.
However, the new-found austerity is seen by some economists as unlikely to be enough for Rousseff to reach a primary surplus goal of 66.3 billion reais or the equivalent of 1.1 percent of gross domestic product.
"Looking forward, we expect the primary balance to start improving from May, but the primary surplus target of 1.1 percent of GDP seems to be a virtually impossible objective by now," economists with Brasil Plural said in a note to clients prior to the release of the results.
The Sao-Paulo based bank expected a surplus of 12.4 billion reais in April.
The overall budget balance, which includes interest payments, returned to positive territory in April with a surplus of 11.232 billion reais thanks largely to central bank gains stemming from the sale of currency swaps that month.
The country's public gross debt as a percent of gross domestic product came in at 61.7 percent in April, down from 62.4 percent in March, the central bank said.
$1 = 3.1636 Brazilian reais Reporting by Alonso Soto; Editing by Chizu Nomiyama and W Simon