Former military ruler Muhammadu Buhari has become the first opposition candidate to win a presidential election in Nigeria.
Mr Jonathan telephoned his rival to concede defeat. Gen Buhari's supporters took to the streets to celebrate.
Observers have generally praised the election, though there have been allegations of fraud.
Election results as they happened
"I promised the country free and fair elections. I have kept my word," Mr Jonathan said in a statement.
He said he had conveyed his "best wishes" to Mr Buhari, and urged "those who may feel aggrieved to follow due process... in seeking redress".
CelebrationsA spokesman for Gen Buhari's All Progressives Congress (APC) party praised Mr Jonathan, saying: "He will remain a hero for this move. The tension will go down dramatically."
Gen Buhari's supporters have celebrated by dancing and singing in the streets in APC strongholds, including the northern cities of Kano and Kaduna.
The APC won 15,424,921 votes and Mr Jonathan's People's Democratic Party (PDP) gained 12,853,162 votes.
Analysis: Will Ross, BBC Nigeria correspondent, Abuja
Gen Buhari's victory is a hugely significant moment in Nigeria's turbulent history. Never before has a sitting president been defeated in an election.
Since independence from Britain in 1960, there have been numerous coups and most elections have been rigged. Of course in a close election there will be many voters who are not pleased with this outcome but the whole process is a sign that democracy is deepening in Nigeria.
The poll has once again brought to the surface dangerous religious and regional differences and there is still a threat of violence.
The man who has been voted out, Goodluck Jonathan, has played a huge part today in trying to prevent that. He made the phone call when there would no doubt have been some in his camp who would have preferred to dig their heels in.
Five reasons why Goodluck Jonathan lost
Profile: Muhammadu Buhari
Profile: Goodluck Jonathan
The APC issued a statement after the result was announced, calling for "calm, sober celebrations" and warning supporters not to attack opponents.
"He or she is not with me, whoever does that," the president-elect said.
He is due to give a speech later on Wednesday.
The former military ruler dominated the country's north-western states, which have suffered most from attacks by Islamist militant group Boko Haram.
In Borno state, one of the worst-affected by Islamist violence, Gen Buhari won 94% of the vote.
It is the fourth time that Gen Buhari, 72, has sought the presidency.
He ruled Nigeria from January 1984 until August 1985, taking charge after a military coup in December 1983.
Mr Jonathan had led Nigeria since 2010, initially as acting leader before winning elections in 2011.
Nigeria has suffered from several attacks by the Islamist militant group Boko Haram, which has killed thousands of people in its drive to establish an Islamic state.
Many voters have said that they believe Gen Buhari is better positioned to defeat Boko Haram.
The verdict on Mr Buhari's 20 months as military ruler is mixed.
The European Union's top diplomat, Federica Mogherini, congratulated Gen Buhari on his victory, saying she "looked forward to working with" him.
Muhammadu Buhari in focus:
- Aged 72
- Muslim from northern Nigeria
- Elected president in 28 March poll
- Military ruler of Nigeria from 1984 to 1985
- Deposed in a coup
- Poor human rights record
- Seen as incorruptible
- Disciplinarian - civil servants late for work had to do frog jumps
- Survived an apparent Boko Haram assassination attempt