South Africa's much bigger-than-expected trade deficit in January wiped out 12 consecutive months of surpluses, as exports of major commodities and machinery fell sharply.

The trade balance in January swung to a 27.66 billion rand ($2 billion) deficit, far beyond market expectations of a 5 billon rand shortfall, from a revised 15.3 billion rand surplus in December, according to South African Revenue Service (SARS) data released on Wednesday.

The trade deficit was the country's biggest for over a decade but analysts said while it was a surprise it was not entirely negative because the surge in imports was a sign of an economic rebound.

"That the deficit was larger than expected shows there are high expectations for 2018. A lot of companies are expecting more trade activities in the domestic economy," said economist at Nedbank Johannes Khoza.

National Treasury last week raised its 2018 economic growth forecast to 1.5 percent from estimated growth of 1 percent in 2017, citing improved business and consumer confidence as well as upbeat global growth.

Business confidence hit its highest since late 2015 in January on expectations that new President Cyril Ramaphosa would lead economic reform and a clamp-down on corruption, while private sector purchasing activity has recovered from 20-month lows.

The rand, often a real-time gauge of investor sentiment, has gained about 15 percent against the dollar since Ramaphosa replaced the scandal-tainted Jacob Zuma as leader of the ruling African National Congress in mid-December.

The currency was unmoved by the deficit data, trading steady at 11.7750 per dollar.

Africa's most industrialised economy has benefited recently from higher global demand for commodities, particularly from resource-hungry China, such as gold, metal and coal driven by faster economic growth in Europe and Asia.

Growth in China's manufacturing sector, often seen as a bellwether for metal demand globally, slowed in February to its weakest in over 1-1/2 years.

The much firmer currency also contributed to the slower export sales, analysts said.

Exports fell by 22.6 percent to 80.5 billion rand on a month-on-month basis in January, while imports rose 21.9 percent to 108.2 billion rand, the SARS said in a statement.

Exports of vehicles and transport equipment plummeted by 47 percent, precious metals were down 34 percent, while mineral sales fell 21 percent in the month.

-Reuters