(Adds details on current account, investment, analyst's quote)
BRASILIA, May 24 (Reuters) - Brazil recorded a surprise current account surplus of $412 million in April, its first in seven years, on the back of an improved trade surplus, the central bank said on Tuesday.
Brazil's last monthly surplus was $124.8 million in April of 2009. This April's performance beat expectations for a deficit of nearly $900 million, according to a Reuters survey.
The result contrasts with a $6.84 billion current account deficit in April 2015.
A depreciation of the real currency and a deep recession have curbed demand for imports and pushed local producers to sell their products abroad, improving the trade balance of the commodities powerhouse.
The current account deficit narrowed sharply to $7.2 billion for the first four months of 2016 from $31.9 billion during the same period last year.
"We expect declining domestic demand (led by the very sharp retrenchment of investment) and a weaker real to continue to drive the current account adjustment," wrote Goldman Sachs chief Latin America analyst Alberto Ramos.
Ramos added that a deep fiscal adjustment is needed to allow for a more permanent adjustment of the current account.
Interim President Michel Temer, who took office earlier this month pending the impeachment trial of President Dilma Rousseff, unveiled a series of austerity measures on Tuesday to close the country's widening fiscal gap.
Brazil attracted $6.8 billion in foreign direct investment in April, more than the $6.2 billion surplus expected by economists polled by Reuters.
The country's current account deficit in the 12 months through April dropped to 1.9 percent of economic output from 2.39 percent in March. (Reporting by Marcela Ayres; Writing by Reese Ewing and Alonso Soto; Editing by Daniel Flynn)