A candidate from Nigeria's ruling party won a key state gubernatorial on Sunday, the electoral body said, marking an early victory for President Muhammadu Buhari ahead of general elections next year.

Challenger Kayode Fayemi, former solid minerals minister of the All Progressives Congress (APC), won the fiercely-contested election in Ekiti state, defeating incumbent Peter Ayo Fayose from the opposition People's Democratic Party (PDP). 

"John Olukayode Fayemi of the APC, having satisfied the requirement of the law and scored the highest number of votes, is hereby declared the winner," said Abel Olayinka, Independent National Electoral Commission officer, in a statement.

The election, which the APC won by 19,338 votes, was free from violence but vote-buying was an issue, said international observers on the ground.

"Money rain in Ekiti as PDP, APC entice voters with cash," wrote the Vanguard, a Nigerian newspaper. 

"Unfortunately, I think it has become part of the system here," said Sentell Barnes, from the International Republican Institute, a US pro-democracy group.

"Before people would stuff ballots, but now that's harder to do with the card reader, so now you find people using money to influence people."

Nigeria's 2015 presidential election, in which Buhari made history by becoming the first opposition candidate to unseat an incumbent, was widely praised as free and fair.

Analysts were watching the high-stakes gubernatorial elections as litmus test of Buhari's popularity and the strength of Nigeria's young democracy. 

"There's a perception that the ruling party is determined to hold onto power next year and the elections in Ekiti and Osun will serve... as a test of how much force they are willing to use," said Cheta Nwanze, of Lagos-based SBM Intelligence.

Buhari, 75, is under pressure to secure a second term as he faces rising violence across the country, from Boko Haram jihadists in the northeast as well as renewed bloodshed in the long-running farmer-herder conflict that has killed 1,000 people since January. 

* Receive IOL's top stories via Whatsapp by sending your name to 0745573535.