His younger brother and successor as president Raul Castro announced the news on state television.
Castro toppled the government in 1959, introducing a Communist revolution. He defied the US for decades, surviving many assassination plots.
His supporters said he had given Cuba back to the people. Critics saw him as a dictator.
Ashen and grave, President Castro told the nation in an unexpected late night broadcast on state television that Fidel Castro had died and would be cremated later on Saturday.
"The commander in chief of the Cuban revolution died at 22:29 hours this evening (03:29 GMT Saturday)," he said. "Towards victory, always!" he added, using a revolutionary slogan.
A period of official mourning has been declared on the island until 4 December, when his ashes will be laid to rest in the south-eastern city of Santiago.
Barring the occasional newspaper column, Fidel Castro had essentially been retired from political life for several years.
In April, Fidel Castro gave a rare speech on the final day of the country's Communist Party congress.
"I'll soon be 90," the former president said, adding that this was "something I'd never imagined".
"Soon I'll be like all the others," Fidel Castro said, suggesting his "turn" to pass away was coming.
Castro was the longest serving non-royal leader of the 20th Century.