John Atta Mills, Ghana's president, has died a few hours after being taken ill, a statement from the president's office and officials said.
Mills, 68, died on Tuesday in the capital Accra and has been succeeded by Vice-President John Dramani Mahama who took the presidential oath hours after the death was announced.
The swift adherence to Ghana's constitution on succession underlines the country's reputation as one of the most mature democracies in the region, said commentators.
"It is with a heavy heart... that we announce the sudden and untimely death of the president of the Republic of Ghana," a statement sent to the Reuters news agency by the president's office said.
|John Evans Atta Mills had been to the United States for medical treatment over an undisclosed illness [AFP]
Mills, who had celebrated his 68th birthday last Saturday, had won international praise as leader of a stable model democracy in Africa. Ghana remains the only Sub Saharan country that Barack Obama, the US president, has visited as part of recognition for its democratic credentials.
The unexpected death of the leader of the world's second-largest producer of cocoa comes months before he was due to stand for re-election in December.
Ghana, also a major African gold producer, started pumping oil in 2010 and posted double-digit growth in 2011.
The president's office said that Mills died a few hours after being taken ill, but no further details were given.
A presidential aide, who asked not to be named, said the president had complained of pains on Monday evening and died early Tuesday afternoon when his condition worsened.
Mills had returned from medical checks in the United States a few weeks ago.
Ghana's election commission said Mills' death would not affect December's presidential and parliamentary elections.
"The election calendar remains unchanged - it's purely a party matter," Kwadwo Afari-Gyan, the elections chief, told Reuters.
"[Mills] signed strong economic agreements with China."
- Nii Akuetteh, Africa commentator
He said it was up to the ruling National Democratic Congress (NDC) to find a candidate to replace Mills.
Trained as a lawyer and taxation expert, Mills had overseen Ghana's emergence as one of Africa's newest oil producers two years ago, winning plaudits both at home and abroad for his sound economic policies and commitment to democracy and good governance.
In March, Obama received Mills in the Oval Office and praised him and his country as "a good-news story" in Africa.
Nii Akuetteh, an Africa commentator based in Washington, DC, told Al Jazeera Mills had been credited with Ghana's "serious economic growth".
He said Mills "signed strong economic agreements with China" and that his "influence goes back because he served as vice-president" during Jerry-Rawlings administration.
Previous rumours about Mills' possible ill-health had swirled in the last few weeks as he travelled last month to the US for medical treatment.
On that occasion, he had joked with reporters on his departure from Accra about rumours of his death, asking them: "Are you seeing a person who has died?"
Mills, who won a close-fought, two-round election in 2008 by beating off rival Nana Akufo-Addo of the then-ruling New Patriotic Party (NPP), was preparing to bid for a second term in December's polls, once again against arch-foe Akufo-Addo.