Obama praised the March vote as “an affirmation of Nigeria’s commitment to democracy.”
He said the people of the oil-rich and diverse nation “understand that only through a peaceful political process can change take place.”
Obama — facing criticism for not including the continent’s most populous country and biggest economy on a Africa tour later this week that will take in Kenya and Ethiopia — turned on the charm, lavishing praise on the former military ruler.
“President Buhari comes into office with a reputation for integrity and a very clear agenda,” he said.
“And that is to make sure that he is bringing safety and security and peace to his country.”
Buhari reciprocated the praise, saying US pressure helped ensure the elections were “free, fair and credible.”
“We will ever be grateful,” he said.
But Buhari, who ruled as a military strongman between 1983 and 1985, returns to office facing a Boko Haram insurgency that has resulted in the deaths of at least 15,000 people and displaced 1.5 million.
Since 2009 the group has been trying to establish an Islamic state in northeast Nigeria.
Buhari’s visit was foreshadowed by a uptick in terror attacks, including suicide bombings in neighboring Cameroon and Chad.
Rights groups say atrocities have been committed both by Boko Haram and the Nigerian military.
US laws banning the transfer of weapons to countries suspected of rights abuses have sometimes pushed a wedge between the two allies.
Obama’s administration last year blocked the sale of Cobra attack helicopters to Nigeria, hampering cooperation amid efforts to find the hundreds of still-missing kidnapped Chibok schoolgirls.
Since being elected in May, Buhari has indicated a readiness to address problems in the army he once ran as a general and as Nigeria’s military ruler.
Earlier this month Buhari sacked his entire military top brass.
Buhari’s purge of senior commanders inherited from his predecessor Goodluck Jonathan was widely expected but is the clearest demonstration yet of his quest for a fresh start.
Obama said successful reforms would mean that “Nigeria ends up being an anchor, not only of prosperity and stability” but, he said, the country “can also be an outstanding role model for developing countries around the world.”
Obama said he ready to discuss “how we can be helpful” in addressing the issues that have held Nigeria back.
Still, he is unlikely to endorse a dramatic ramping up of US military activity against Boko Haram — fearing it could be used by the group as a recruiting tool and entangle the United States in yet another conflict.