Statistics South Africa said the economy contracted by 0.7 percent in the second quarter, led by declines in the agricultural, transport and retail sectors.

South Africa entered recession in the second quarter for the first time since 2009, data showed on Tuesday, in a stinging blow to President Cyril Ramaphosa's efforts to revive the economy after a decade of stagnation.

October 2017: South Africa is fighting to revive its frayed clothing industry, once a crucial provider of jobs in a country suffering from high levels of unemployment, that has victim to a flood of cheap imports that has forced local factories to shutter and lay off workers.

The rand stretched losses against the dollar to more than 2 percent and government bonds fell after the data was released. Analysts had predicted that the economy would grow 0.6 percent in the latest quarter.

"We are in a recession. We reported a contraction in the first quarter ... and now in the second quarter with a fall of 0.7 percent," South Africa's Statistician-General Risenga Maluleke said.

Statistics South Africa said agricultural output fell 29.2 percent in the second quarter, while the transport, communication and storage sector fell 4.9 percent. Mining output grew by 4.9 percent and finance by 1.9 percent, however.

Stats SA also said the economic contraction in the first quarter was steeper than initially recorded, at 2.6 percent.

Analysts said the dismal data would likely make it harder for the South African Reserve Bank to raise interest rates at its upcoming meetings.

"There is no way to sugar coat the numbers, the growth picture in the first half of 2018 is ugly and it shows in this economy that there is broad based weakness across the primary and tertiary sectors of the economy," said senior economist at BNP Paribas Jeffrey Schultz.

"It is spooking the market it wasn't an expected print, a lot of analysts and ourselves were expecting a very modest second quarter print, but we certainly weren't expecting a negative."