Spanish far-right right groups have used the site as a rallying point, staging demonstrations against the proposal relocation.
Mr Sanchez said the ruling was “a great victory for Spanish democracy”.
Immediately after the ruling was announced, around 40 supporters gathered at the basilica where Franco lies.
One of them told the AFP news agency: “I have come specifically to say goodbye to Franco.
“This is the proof that there is a hatred among the left for this man. Who are they to touch the body of Franco?”

Franco ruled Spain from the end of the country’s civil war in 1939 until his death. The country embraced democracy in the years that followed.
Hundreds of thousands of people were killed in Spain’s civil war between 1936 and 1939, in which Franco’s Nationalists fought against left-leaning Republicans and Communists supported by the Soviet Union.
Nearly 34,000 people are buried at Valle de los Caídos, including many who fought for the Republicans whose bodies were moved there without their families’ permission.
Franco is the only person there not to be a civil war victim.