* John Dramani Mahama, 53, sworn in to replace dead leader
* Death came after Mills taken ill, president's office says
* Mills, 68, had won international praise for stable rule (Updates with vice president sworn in, adds reaction)
By Kwasi Kpodo
ACCRA, July 24 Ghana's President John Atta Mills, who won international praise for presiding over a stable model democracy in Africa, died suddenly on Tuesday and his vice-president was quickly sworn in to replace him at the helm of the oil, gold and cocoa producer.
Mills had celebrated his 68th birthday on Saturday and his unexpected death came months before he was due to stand for re-election in December as head of the world's No. 2 cocoa grower, which is also a major African gold producer.
"It is with a heavy heart ... that we announce the sudden and untimely death of the president of the Republic of Ghana," the president's office said. It added that Mills had died a few hours after being taken ill, but gave no further details.
A presidential aide, who asked not to be named, said the president had complained of pains on Monday evening and had died early on Tuesday afternoon when his condition worsened.
In line with Ghana's constitution, Vice-President John Dramani Mahama, who is 53, took the oath of office as head of state before a sombre parliament hours after the announcement of Mills' death. Mahama will serve as caretaker president until the elections at the end of the year.
Analysts hailed this as a sign that the country's political institutions were solid and working smoothly.
"With Ghana's reputation for stability, having seen two peaceful transitions in government following elections in 2000 and 2008, the strength of Ghana's institutions are likely to see the country in good stead," said Razia Khan, head of Africa research at Standard Chartered.
"As such, market volatility related to near-term uncertainty is likely to be limited," she added.
Amid swirling rumours about his ill health, Mills had returned from medical checks in the United States a few weeks ago. Some reports by local newspapers speculated he had throat cancer, other reports mentioned a sinus-related affliction.
Ghana's election commission said December's presidential and parliamentary elections would go ahead as planned.
OBAMA PAYS TRIBUTE
Some analysts questioned whether Mills' death might open up a presidential candidacy battle inside the ruling National Democratic Congress party before the elections. The party will hold an emergency congress to elect a new presidential candidate to contest the vote.
"Elections will have to be held soon and one does not know what the new president will decide, in particular in terms of resource nationalism. Elections are always a factor of instability in Africa," said Martin Bauwens, managing director of Johannesburg-based mine consultancy MJB Consulting.
Producers in Africa's second largest gold producer have raised concerns about government moves to raise the corporate mining tax to 35 percent from 25 percent and to introduce a 10 percent windfall tax as well.
Ghana's state and private radio and TV channels suspended regular programming and played patriotic songs between messages of condolence, urging Ghanaians to unite in a time of grief.
U.S. President Barack Obama, who had received Mills in the Oval Office in March and praised him and his country as "a good-news story" in Africa, also sent his condolences.
"He helped promote economic growth in Ghana in the midst of challenging global circumstances and strengthened Ghana's strong tradition of democracy ... He was also a strong advocate for human rights and for the fair treatment of all Ghanaians," Obama said in a statement from the White House.
Trained as a lawyer and taxation expert, Mills had overseen Ghana's emergence as one of Africa's newest oil producers two years ago, earning respect at home and abroad for his economic policies and commitment to democracy and good governance.
Ghana has seen democratic elections decide its leadership no fewer than four times since the last military coup in 1981, a rare feat in a region where power is still just as often determined by the bullet as by the ballot.
The new caretaker president, Mahama, has just published a book entitled "My First Coup d'Etat: And Other True Stories from the Lost Decades of Africa", a memoir of his early years in the often turbulent events that followed Ghana's 1957 independence from Britain. (Additional reporting by Stella Mapenzauswa and Ed Stoddard in Johannesburg, Matt Spetalnick in Washington; Writing by David Lewis and Pascal Fletcher; Editing by Andrew Osborn)