By Heidi Vogt in Abuja and Patrick McGroarty in Yola, Nigeria 

ABUJA, Nigeria--Nigerians headed to the polls Saturday morning to choose a leader of a country where past election disputes have set off waves of deadly violence.

The outcome of Saturday's contest, and the way Nigerians react, will help set the trajectory of Africa's beleaguered top economy.

President Goodluck Jonathan--in power since 2010--is running against Muhammadu Buhari, a fourth-time candidate with wide support among Muslims in the north of the country. Mr. Jonathan's support base is the predominantly Christian south.

An incumbent has never lost an election in Nigeria, but polls have shown the two in a tight race. When Mr. Jonathan beat Mr. Buhari in 2011, riots broke out across northern Nigeria, where Muslims and Christians mingle in cities like Kaduna and Kano. Human Rights Watch says more than 800 were killed.

But the two men have pledged to make this time different. Mr. Jonathan and Mr. Buhari embraced each other in the capital on Thursday and signed a peace pact that committed both to encouraging a free, fair and orderly vote.

The government went to extraordinary lengths to assure Nigerians that they would be safe on Saturday, closing land and sea borders for days and even barring most road traffic on Saturday. Officials said a polling station was within walking distance of most of the 50 million voters.

Yet this election has also been complicated by the threat of Boko Haram militants. It was delayed for six weeks to give the military more time to beat back the insurgents, who have vowed to disrupt the vote. The military has retaken a large amount of the northeast from the militants, but hundreds of thousands are displaced and it is unclear how many will actually go out to the polls in the battered region.

Civil activists worry that a new system to verify each voter using a plastic verification card and a hand-held electronic scanner could malfunction or result in long lines that could raise tensions even further.

But some observers say the new system should also head off the more blatant ballot-stuffing tactics believed to have marred past Nigerian elections.

"People are not going to be able to vote by proxy or vote in someone else's name," said Chris Fomunyoh, the Central and West Africa director for the Washington-based National Democratic Institute, which is leading a team to vote watchers.

More than 56 million voters picked up the cards that will allow them to vote on Saturday at more than 150,000 polling stations.

A year ago Nigeria passed South Africa as the biggest economy in Africa. Since then oil prices have plunged to half their former value. The price drop has drained revenue from Africa's top crude producer, hammered Nigeria's currency and dimmed its growth outlook.

Mr. Jonathan, a 57-year-old former zoology professor, says he will raise new revenue from a luxury tax and cut spending. Mr. Buhari, 72, who briefly ruled Nigeria as a military dictator in the 1980s, has vowed to tackle corruption.

Tension is running so high and the vote so close that supporters of whichever candidate loses are likely to lash out, said Mausi Segun, the Nigeria researcher for Human Rights Watch. "There is likely to be violence," she said.

In Yola, a regional capital at the southern edge of the Belgium-sized chunk of arid scrubland that Boko Haram controlled for much of the past year, people who fled attacks on their towns and farms said they want to vote out a president they feel has abandoned them.

"Our government is not serious about finishing this insurgency," said Suleiman Sanusi, whose town was overrun by militants in September, forcing the 43- year old farmer, his two wives and 11 children to cram into a small plywood room in Yola. "We have so much doubt," he says.

Write to Heidi Vogt at heidi.vogt@wsj.com and Patrick McGroarty at patrick.mcgroarty@wsj.com