A steep decline in imports saw Brazil post a better-than-expected trade surplus of $2.761 billion in May to trim its deficit for the year to date to 2.305 billion, the government said Monday.
The May result, the best since 2012, continued a trend which started in March and gave Brazil some room for maneuver after January-February brought a combined deficit of $6 billion.
Trade Ministry figures showed imports down by more than a quarter, 26.5 percent, on May 2014 while exports slid 15.2 percent.
For January-May, exports fell 16.2 percent compared with imports off a total 18.1 percent over the same period.
In April, Brazil delivered a $491 million trade surplus.
Brazil last year unveiled its first annual trade deficit in 14 years at $3.930 billion on falling commodity prices as well as economic weakness in neighboring Argentina, a major regional trading partner.
Those factors have continued to depress the performance of South America's largest economy.
The economy as a whole has struggled with Brazil facing a fifth straight year of low growth. IMF and government forecasts expect a contraction of around 1.0 to 1.2 percent this year following a meager 0.1 percent rise in GDP last year.
The government has responded with a package of austerity measures, last month announcing spending cuts of $23.3 billion.