(CNN) Two of the largest economies in Africa are growing again after recessions.
Nigeria's GDP expanded by 0.55% in the second quarter of 2017 year-on-year, according to the National Bureau of Statistics, ending five consecutive quarters of contraction. Quarter-on-quarter growth for the same period was 3.23%.
The South African economy grew by 2.5% quarter-on quarter for the three months to June 30 after two quarters of decline, according to official statistics.
Growth in Nigeria marks the end of its worst recession in 25 years.
Africa's leading oil producer has been hard hit by falling prices for the commodity, which accounts for the majority of its export revenue.
But the oil sector has recovered slightly in the last quarter, with growth of 1.6% year-on-year.
Nigerian agriculture, which contributes around 23% of GDP, has also rebounded with growth of 3% over the same period.
South Africa's recovery from a shorter recession has been supported by growth across a range of industries.
The agriculture sector expanded by 33.6% quarter-on-quarter, boosted by strong harvests of crops such as maize and wheat.
The finance industry also performed well with growth of 3.5%, and the mining industry expanded by 3.9%, supported by increased production of coal and gold.
But despite these positive indicators, Statistics South Africa warned that the recovery remains fragile as "longer-term indicators show subdued growth."