* GDP fell 0.7 percent in Q2 - statistics office

* Agriculture and transport contribute to decline

* Fixed investment still in negative territory

* President Ramaphosa trying to revive economy (Adds details, context, analyst quote)

PRETORIA, Sept 4 (Reuters) - 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.

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

The rand stretched losses against the dollar to more than 2 percent and government bonds fell after the data was released. Analysts had predicted 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,” Statistician-General Risenga Maluleke said.

Africa’s most developed economy needs faster economic growth if it is to reduce high unemployment - currently at 27 percent - and alleviate poverty and inequality that stokes instability.

Unemployment is a hot-button issue ahead of national elections in 2019, and the African National Congress (ANC) has made repeated pledges that things will improve.

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

Statistics South Africa said the economic contraction in the first quarter was steeper than initially recorded, at 2.6 percent, and that gross fixed capital formation fell by 0.5 percent in the second quarter.

Ramaphosa has made wooing foreign and domestic money a cornerstone of his economic reform agenda, so the investment numbers will come as a big disappointment.

The buoyant market mood that took hold after he was elected leader of the ruling ANC in December and then president of South Africa in February appear to have dissipated.

The president is currently in China, attending a summit. President Xi Jinping pledged $60 billion to African nations at Monday’s opening of a China-Africa forum on cooperation.

SHARP REBOUND UNLIKELY

Economists said the dismal data would probably make it harder for the South African Reserve Bank to raise interest rates, as inflation has been gradually rising in recent months. Inflation stood at 5.1 percent in July.

The GDP figures could also draw the attention of ratings agencies, who have South Africa’s sovereign ratings near “junk” status.

“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.

Head of research at ETM Analytics, George Glynos, said the recession was a function of years of maladministration.

“Clearly this is not what Ramaphosa would like running into the elections next year,” he said. “The optics of South Africa are poor.”

Jason Tuvey, senior emerging markets economist at Capital Economics, said he expected the economy to recover over the rest of this year but that a sharp rebound was unlikely.

“Today’s data will further dent hopes that Cyril Ramaphosa’s presidency would lead to a marked turnaround in South Africa’s economic fortunes,” Tuvey wrote in a note. (Additional reporting by Tanisha Heiberg in Johannesburg; Writing by Alexander Winning; Editing by James Macharia and Andrew Roche)