As part of a last-ditch attempt to stop the exhumation, Franco’s family has appealed separately to a local court in Madrid that grants public works licenses, arguing that there are technical and safety concerns linked to the opening Franco’s tomb, which is behind the basilica’s altar.

Upon taking office in June 2018, Mr. Sánchez announced that Franco’s exhumation would happen “immediately.” Instead, his plan got entangled in a political and legal quagmire, which also revived the debate over the law of amnesty for past crimes that was adopted in 1977, two years after Franco’s death, as part of Spain’s return to democracy.

Franco’s relatives appealed to the Supreme Court, which suspended the exhumation plan in June to give it time to review the case. While the government has suggested that Franco should be moved to his family crypt in the cemetery of El Pardo, on the outskirts of Madrid, Franco’s family has argued that the only alternative resting place for the former dictator would be inside the crypt of Madrid’s cathedral — a suggestion that the government vowed to block.

Mr. Sánchez wants to exhume Franco as part of a broader effort to revive a law of historical memory that was approved in 2007, under a previous Socialist government, but was shelved and deprived of state funding by the conservative government led by Mariano Rajoy. One of the main goals of the law was to support and help finance the opening of the more than 2,000 mass graves that dot Spain and to identify the remains of those inside, who mostly died during the three years of the civil war of the 1930s.

Conservative politicians have denounced Mr. Sánchez’s determination to exhume Franco as a political strategy to strengthen ideological divisions, but it has led to concerns that it could also bolster the far right, as seen in the emergence of Vox. Mr. Sánchez and his Socialists won the election in April, but fell short of an outright majority of Parliament seats.

Mr. Sánchez will be hoping that voters give the Socialists a stronger mandate to govern in the do-over election, and he has been bolstered by the splintering of some smaller left-wing parties. But there is no guarantee that the new vote will yield a different result, and opinion polls suggest that turnout will be low.