MADRID — In September, Pedro Sánchez, Spain’s caretaker Socialist prime minister, called off coalition talks with a smaller left-wing party, Unidas Podemos, saying that he “could not have slept at night” if he had allowed its more radical politicians into his government.

It is unclear, however, that Mr. Sánchez has been able to sleep better since.

The acrimonious breakdown of talks to form a government is forcing Spain to hold its fourth national election in four years, a vote that will take place on Sunday. And the latest opinion polls suggest that the outcome is too close to call, with no single party likely to come near to winning a parliamentary majority.

The vote could plunge Spain into another round of tortuous coalition talks that would prolong the political sclerosis.

Mr. Sánchez and his Spanish Socialist Workers’ Party remain in the lead, according to pollsters, but the repeat election provides an unexpectedly early opportunity for right-wing parties to benefit from the bickering among left-wing politicians. One of the parties most likely to reap such gains is the anti-migration and ultranationalist Vox party, which entered Parliament after winning 10 percent of the vote in the last election, in April.