The judge convicted him of rape, sexual slavery and ordering killings during his rule from 1982 to 1990.
Victims and families of those killed cheered and embraced each other in the courtroom after the verdict was given.
It was the first time an African Union-backed court had tried a former ruler for human rights abuses.
Habre, who received strong backing from the US while in power, has been given 15 days to appeal.
Survivors from the Habre era welcomed the verdict.
“This is a historic day for Chad and for Africa. It is the first time that an African head of state has been found guilty in another African country,” Yamasoum Konar, a representative of one of the victims’ groups, told the BBC.
“This will be a lesson to other dictators in Africa,” he added.
After he was sentenced, Habre remained defiant, raising his arms and shouting to his supporters as he was led from the courtroom.
“Down with France-Afrique!” he shouted, using a term which is critical of France’s influence in its former colonies.
Throughout the nine-month trial, he refused to recognise the court’s legitimacy, frequently disrupting proceedings.
The ex-president denied accusations that he ordered the killing of 40,000 people during his rule from 1982 to 1990.
His critics dubbed him “Africa’s Pinochet” because of the atrocities committed during his rule.
Survivors had recounted gruesome details of the torture carried out by Habre’s feared secret police.
One of the most notorious detention centres in the capital N’Djamena was a converted swimming pool.
Witnesses said victims endured electric shocks, near-asphyxia, cigarette burns and having gas squirted into their eyes.
Analysis: Abdourahmane Dia, BBC Afrique, Dakar
The verdict will be seen as a major step forward by those who are campaigning for African leaders to be tried on the continent for war crimes.
They have been pushing for a permanent African court of justice to be set up, believing war crimes suspects should be prosecuted on the continent rather than at the Hague-based International Criminal Court (ICC).
But some people were critical of the AU-backed court, set up specifically to try him. They argued that it was under Western influence as it had been partly funded by the European Union and US.
However, survivors of Habre’s atrocities did not seem to care who funded the court. They were just relieved that justice had been done, 25 years after his rule ended.
Some of his victims were subjected to “supplice des baguettes” (torture by sticks), when the victim’s head is put between sticks joined by rope which is then twisted.
Gberdao Gustave Kam, president of the special court, said Habre had also committed three acts of rape.
Habre was arrested in Senegal, where he was exiled, in 2013.
Many of his victims campaigned for him to be tried following his overthrow in 1990.
“Today will be carved into justice as the day that a band of unrelenting survivors brought their dictator to justice,” said Reed Brody from Human Rights Watch, who has worked on the case for 17 years and was in court for the judgement.
In 2005, a court in Belgium issued a warrant for his arrest, claiming universal jurisdiction but, after Senegal referred the issue to the African Union, the AU asked Senegal to try Mr Habre “on behalf of Africa”.
In 2013, a court in Chad sentenced him to death in absentia for crimes against humanity.
• Born in 1942 to ethnic Toubou herders in northern Chad
• Given scholarship to study political science in France
• First came to the world’s attention in 1974 when his rebels captured three European hostages to ransom for money and arms
• Seized power in 1982 allegedly with the help of the CIA
• Ousted by current President Idriss Deby in 1990
• Accused of systematically persecuting groups he distrusted