(Adds outlook for Q2, trade balance data, background on interest rates)
By Silvio Cascione
BRASILIA, June 1 (Reuters) - Brazil's economy emerged from its worst recession on record with its fastest growth rate in nearly four years, data showed on Thursday, boosting President Michel Temer's case for staying in office as he battles a corruption scandal.
Brazil's gross domestic product (GDP) grew 1.0 percent in the first quarter from the preceding one, matching economists' forecasts for the biggest rise since the second quarter of 2013.
Growth is unlikely to stay as strong in the second quarter, economists said, as the first-quarter performance was driven up by extraordinary harvests of corn and soy and by a strong buildup in inventories across the economy.
Yet Temer, who has resisted protests for his resignation after being placed under investigation by the Supreme Court, tweeted minutes after the release: "The recession is over!"
"It's the result of the measures we are taking. Brazil is growing again and will grow even more with the reforms," he went on. He was referring to a legislative agenda seen as crucial for balancing the budget but which got stuck in Congress as his allies debated whether to break ranks with the government.
Fourteen million workers remain unemployed in Brazil, a country with one of the biggest gaps between the wealthy and poor. Many analysts expect Latin America's largest economy, operating now at 2010 levels and forecast to grow just 0.5 percent in 2017, will continue running below potential throughout next year at least.
Subpar growth, in turn, should give policymakers room to continue cutting interest rates in coming months. The central bank slashed its benchmark Selic rate by 100 basis points on Wednesday to 10.25 percent and flagged further cuts to come, although probably at a slower pace because of the political uncertainty.
Brazil's economy shrank more than 3 percent in each of the past two years, the deepest and longest downturn since records began in 1901. As the recession deepened last year, Temer's predecessor, Dilma Rousseff, was impeached for breaking budget rules amid record-low approval ratings.
Temer's hold on power seemed in danger two weeks ago when the billionaire owners of meatpacker JBS SA accused him of condoning bribes to silence a key witness in a corruption probe. But lack of a clear replacement and signs of economic growth have given the scandal-plagued president some breathing room, allies have said.
"There is still some way to go before a full recovery but we're in the right direction," Finance Minister Henrique Meirelles said in a statement praising what he called a "historical day" for Brazil.
IBGE also revised up fourth-quarter data to show that Latin America's largest economy contracted 0.5 percent in that period, and not 0.9 percent as originally reported.
Agricultural output rose in the first quarter at the fastest pace since 1996. Services remained stagnant and manufacturing grew only slightly in the first quarter, driven up by stronger exports, IBGE said. Government data later on Thursday showed a record trade balance in May.
Brazil's economy shrank 0.4 percent in the first quarter from the year-earlier period, following a 2.5 percent drop in the previous quarter. (Reporting by Silvio Cascione; Editing by W Simon and Chizu Nomiyama)