Colourful aristocrat Luisa Isabel Alvarez de Toledo y Maura provoked a final scandal just hours before her death in 2008 at the age of 71, when she married a much younger woman who was her long-time secretary and made out her will to her new spouse.
But a court in Sanlucar de Barrameda, where de Toledo maintained the ancestral palace, ruled that around €33 million ($36 million) left in a foundation be divided between the children and Liliana Maria Dahlmann, the aristocrat's widow.
The judge last week ruled that de Toledo had already given away more than a third of the estate during her lifetime, more than she was legally permitted to do so, documents seen by AFP showed.
The palace, situated in a rural area near the southern city of Cadiz in Andalusia, was declared a national heritage site in 1978 and is managed by the Spanish ministry of culture.
Its archive which contains around six million historical documents, the oldest of which dates back to 1228.
The inheritance could have been far greater but de Toledo - dubbed the "Red Duchess" for her opposition to the dictatorship of General Francisco Franco - gave away her vast estates to form rural co-operatives until she owned little more than the palace itself.
The property cannot be divided and so the three children from her first marriage, which ended in divorce, will receive their share of inheritance from the foundation in cash, the judge ruled.
Eldest son Leoncio will receive €16 million, while his sister Pilar and brother Gabriel will get 5.5 million each. German Dahlmann, who met de Toledo at the wedding of her eldest child in 1983, was awarded €6.2 million.
De Toledo spent eight months in jail in 1967 after she led a demonstration demanding compensation for farmers whose lands were contaminated when two American aircraft collided and accidentally dropped hydrogen bombs near the village of Palomares in southern Spain.
The duchess left Spain after she was sentenced to jail again in 1970 because of a book she wrote that was critical of police brutality and prison conditions.
Unwilling to spend another term behind bars she moved to France and only returned to Spain after Franco's death in 1975.