(Recasts with background, year-on-year decline)
RIO DE JANEIRO, July 14 (Reuters) - Economic activity in Brazil fell an unexpected 0.51 percent in May, central bank data showed on Thursday, reversing a small rise in April and highlighting the challenges facing the country as it tries to escape the deepest recession in generations.
A Reuters survey of economists had forecast economic activity would remain stable compared to April, when it registered its first rise since 2014, albeit by just 0.03 percent.
The surprisingly poor performance, a gauge of activity in the farming, industry and services sectors, marked a 5.32 percent fall on the same month last year.
Brazil’s economy is going through a second year of what analysts estimate to be its worst recession in more than a century. (Reporting by Stephen Eisenhammer and Marcela Ayres; Editing by Jeffrey Hodgson)