Japan posted a surprise trade surplus of 32.9 billion yen, or $397.35 million, in February -- its first in five months, amid strong exports to the U.S., the Ministry of Finance said.

Economists surveyed by Bloomberg had predicted a decrease of 6.5 percent in exports, compared with a year earlier; overseas shipments, however, fell to 2.7 percent in February. Imports rose 9.2 percent from the previous year.

Japanese exports to the U.S. rose 11.9 percent, while exports to Canada shot up 22.7 percent. Exports to the Middle East also rose, by 11.8 percent, though that was offset by a 14.6 percent increase in natural gas and petroleum driven imports from the region.

Japan's increase in exports to the U.S. was driven by the automotive industry, which saw a 7.5 percent rise in value of exports to the country.

The rise in exports has largely been driven by the yen's declining price against the dollar since the  Bank of Japan expanded stimulus on Feb. 14, according to Bloomberg. The yen has since declined in value by about 7 percent against the dollar. A weaker yen makes Japanese goods less expensive overseas.

In all, Japan exported 5.44 trillion yen, or $65.76 billion, worth of goods in February, and imported about 5.41 trillion yen, or $65.4 billion, worth of goods.

Japan, the world's third-largest economy, has been seeking to regain its footing after an earthquake and tsunami devastated northeastern regions last March, crippling a nuclear reactor and forcing the evacuation of thousands of people.

A nonprofit economic forecasting group in Japan said on Thursday it expects the country's economy will maintain a slow growth rate of 1.1 percent on exports and reconstruction efforts. That growth rate, however, could slow to 0.9 percent in the longterm if the yen continues to appreciate and costs associated with the shutdown of several nuclear power plants increase, according to a report by the Japan Center for Economic Research.