A panel of three judges headed by Lord Chief Justice Lord Thomas said Mr Dewani could be extradited if the South African government gave a crucial promise.
Lord Thomas said extradition would not be "unjust or oppressive" if officials undertook to return Mr Dewani to the UK if, after "a year or other stated reasonable period", mental illness still prevented a trial.
A lawyer for the South African government said it was "delighted" with the court's ruling and expected it would be able to give the undertaking, but needed 14 days for "clarification".
Referring to the fact Mr Dewani's wife Anni died more than three years ago, Lord Thomas said: "The interests of justice require expedition and that there should be no further delay, provided proper protection is afforded to the appellant."
Mr Dewani, from Bristol, can still try to take his case to the Supreme Court. He is accused of ordering the killing of Anni, 28, who was shot as the couple travelled in a taxi on the outskirts of Cape Town in November 2010.
The court heard he has mental health problems and is compulsorily detained in hospital under the Mental Health Act. His lawyers have stressed he will be willing to defend himself at trial once he is fit to do so but they say he is unfit to plead under English law and his "prognosis is not certain".
Amit Karia, Anni's cousin, said: "We are happy with the judgment. We have waited for it for three years, three months."
But he warned there was still a possibility Mr Dewani could launch another appeal and said: "We are always worried and don't take anything for granted."
Three men have been convicted over Mrs Dewani's death. Xolile Mngeni was given life for premeditated murder, taxi driver Zola Tongo was jailed for 18 years and Mziwamadoda Qwabe for 25 years.