UPDATE 1-Brazil exits recession with fastest growth rate since 2013

(Adds Q4 revision, background)

BRASILIA, June 1 (Reuters) - Brazil's economy emerged from its worst recession on record with its fastest growth rate in nearly four years, government data showed on Thursday, in some good news for President Michel Temer as he battles a corruption scandal.

Brazil's gross domestic product grew by 1.0 percent in the first quarter from the preceding one, statistics agency IBGE said, the fastest pace since the second quarter of 2013.

The increase, the first after eight quarters of contraction, matched the median forecast of economists polled by Reuters.

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.

The end of Brazil's deep recession bodes well for the unpopular Temer, who has resisted protests for his resignation after the Supreme Court opened an investigation against him for corruption and obstruction of justice.

"The recession is over! It's the result of the measures we are taking," Temer tweeted minutes after the GDP numbers were released.

The country's deepest and longest downturn since records began in 1901 has caused massive unemployment and helped topple former President Dilma Rousseff last year, who was impeached for breaking budget rules and had record-low approval ratings.

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)