Speaking at the funeral, current UN secretary-general Antonio Guterres said Annan was an exceptional leader who saw the UN as a force for good.
“As we face the headwinds of our troubled and turbulent times, let us always be inspired by the legacy of Kofi Annan,” Mr Guterres said.
“Our world needs it now more than ever,” he added.
By Mayeni Jones, BBC News, Accra
Mourners in traditional black and red attire filled the main hall of the Accra Conference Centre, which sits about 4,000 people. More are watching proceedings on a giant screen in an auditorium just outside the hall.
There have been hymns and a performance by soprano and human rights campaigner Barbara Hendricks.
Annan’s nephew Kojo Amoo-Gottfried read a eulogy, describing how he had led a hunger strike in his secondary school to protest against the quality of food in the dining hall.There were also a moving tribute by his wife, Swedish lawyer and artist Nane Maria Annan. She described how her husband was always excited to return home, and thanked Ghana for giving the world such an extraordinary man
She said her husband had an irresistible aura of radiant warmth.
“His legacy would live on through his foundation and through all of us,” she concluded.
The former queen of the Netherlands, Princess Beatrix, and her daughter-in-law Princess Mabel, who were close friends of Annan, were among the mourners.
The king of Ghana’s Asante people, Otumfuo Nana Osei Tutu II, awarded Annan the title Busumuru in 2012 to honour his role as an international diplomat.
Busumuru is one of the swords attached to the monarch’s Golden Stool, or throne.
Ghana’s President Nana Akufo-Addo described Annan as “one of the truly iconic figures of modern times”.
“The outpouring of tributes from the world over is an accurate measure of the man, a man who gave his life to making peace where there was conflict, to defending the voiceless who were powerless, to promoting virtue where there was evil,” he said.
The Anglican bishop of Annan’s home city of Kumasi in central Ghana, the Most Reverend Daniel Sarfo, said: “Today history is being made in Ghana. One of our illustrious sons is lying here.
“But we are grateful that God used him over the years to work for humanity, for peace. Today, as he lies here, he has finished his work.”