A construction site of the Lagos Rail Mass Transit system in Nigeria. Joe Penney | Reuters

For an oil-reliant economy that's in the throes of a prolonged slump in crude prices, combating terrorism and fending off questions about its president's health, Nigeria has managed to defy the odds. After a weak 2016, Africa's largest oil producer has crawled out of recession, helped in part by the recovery in crude. Nigeria's oil output has rebounded to 1.8 million barrels a day, at a rate far quicker than market watchers anticipated. The recovery "is being driven by the pickup in oil prices, which is helping production volumes recover as well," said Nicolas Jaquier, an emerging market economist at Aberdeen Standard Life.

Nigeria President Muhammadu Buhari Frank Augstein | Pool | Reuters

Structurally, Nigeria's large oil reserves and attractive demographics — the country has a comparatively young population and is expected to become the world's fourth most populous nation by 2050, according to the CIA World Factbook — make it an attractive bet for investors. "We believe the long-term internal demand story is intact and remains robust," Rohit Chopra, a portfolio manager and co-head of Lazard Asset Management's emerging markets equities team, told CNBC. "As interest rates in the developed world remain low, there is growing investor interest in potentially higher returning frontier markets such as Nigeria," Chopra said. Economic reforms like cutting fuel subsidies, boosting tax collection and anti-corruption policies have "seemingly peaked investor interest," he added. Investor interest in Nigeria has also increased dramatically since the central bank relaxed the county's exchange rate regime in the second quarter of this year. Under the new measures, portfolio investors could access foreign exchange in a free-floating window, boosting confidence that they would be able to liquidate and repatriate capital with relative ease. "This goes some way to explaining the substantial rally in Nigerian equities over recent months. With business conditions slowly improving, sectors that leverage Nigeria's large population in particular will begin to attract increasing investment," said David Earnshaw, a senior risk analyst for sub-Saharan Africa at BMI Research.

Reforms and terror threats cloud the outlook