Analysts and investors who expected Nigeria’s presidential election to erupt in chaos are celebrating the relatively peaceful victory of opposition leader Muhammadu Buhari — and the excitement is evident in the country’s stock market.

“Financial markets have welcomed the result,” wrote Capital Economics Africa analyst John Ashbourne in a note Tuesday, adding that as poll results continued to roll in from around the country on Monday, the Nigeria All Share Index gained 2.1 percent and the yield on Nigeria’s 2021 eurobond fell by almost 20 basis points, its lowest level this year.

Until now, investors had been particularly wary of the outlook for Nigeria — Africa’s largest economy and the world’s No. 4 oil producer, fueled by crude reserves in the Niger Delta. But global benchmark oil prices have fallen more than 50 percent in recent months, taking Nigeria’s currency with them and leaving a gaping hole in government revenues. The World Bank recently revised its prediction for the country’s economic growth in 2015 down from 6.3 percent to 5.5 percent. 

The All Share Index was down last month and the country's currency, the naira, took a record tumble in the run-up to election. Many observers expected increased anxiety at a time of increasing security concerns related to Boko Haram violence in the northeast. 

However, this weekend's election process was relatively peaceful. Despite a handful of protests and 41 deaths due to Boko Haram attacks, it was a vast improvement over the 2011 vote, which led to violence that killed least 800 people.

Voters chose opposition leader and former military ruler Buhari, 72, over President Goodluck Jonathan, 57, after the closest race since Nigeria left military rule in 1999.

While Buhari is still an unknown quantity in terms of his fiscal and monetary strategy, many Nigerians are optimistic about his anti-corruption promises and are eager to move on from policies favored by the incumbent Jonathan. Stocks in competing countries such as South Africa and Kenya gained roughly 90 percent since 2010, when Nigeria’s gain was just 11 percent under Jonathan’s leadership, according to Bloomberg.

Nigeria ranks 136 out of 173 on Amnesty International’s Corruption Perceptions Index, tied with Russia, Iran and Kyrgyzstan. Last year, watchdogs criticized Jonathan’s decision to dismiss the central bank governor, Lamido Sanusi, after he wrote a letter to the government about $20 billion in oil revenues that had not been accounted for.

Consequently, analysts predict positive market outcomes to accompany Jonathan’s loss.

“The market will react positively to a Buhari win,” Ecobank Transnational Inc. analyst Kunle Ezun told Bloomberg. “It will bring forth positive sentiment.” His platform was built around anti-corruption efforts and making conservative changes to the economy to benefit the disadvantaged. Of course, it remains to be seen how Buhari, a former military leader, will be able to follow through on campaign promises.

For now at least, markets are up slightly, but any real change will take time.

“I think at the moment, political risk is still very high and I wouldn’t be surprised if we saw a slowdown in [foreign investment] until we know really what the economic and political outlook is,” Bank of America Merrill Lynch analyst Oyin Anubi told CNBC.

There’s still time for investors to digest Buhari’s win. He won’t be sworn in until the end of May.