The extremist group seized more than 270 girls from a school in Nigeria in 2014
Twenty one of the school girls kidnapped in Nigeria in 2014 have been freed.
Garba Shehu, spokesman for the President, confirmed the release was "the outcome of negotiations between the administration and Islamist militants".
Boko Haram seized more than 270 girls aged between two and 15 from a school in Chibok, north-east Nigeria two years ago, triggering global outcry.
It sparked one of the biggest global social media campaigns, with tweeters like Michelle Obama using the hashtag #BringBackOurGirls.
"I can only weep, right now. You know that kind of cry that is a mix of multiple emotions," Obiageli Ezekwesili, one of the leaders of the #BringBackOurGirls movement, has tweeted in response to the news.
The president also tweeted that he welcomed the release "following successful negotiations".
President Muhammadu Buhari's spokesman said on Twitter that the International Committee of the Red Cross (ICRC) and the Swiss government had acted as mediators in the talks with Boko Haram.
Mr Shehu added that negotiations were continuing.
Boko Haram has been driven out of most of its bases in northern Nigeria but in the past year, it has moved across the border to Chad.
In 2015, the Nigerian army rescued 200 girls and 93 women kidnapped by Boko Haram. International diplomats had previously expressed grave concerns about Nigerian authorities' ability to find the missing girls, newly released documents have shown.