MADRID — Before Sunday’s election in Spain, politicians had exchanged dire warnings over whether the country would break apart if the left won, or return to the dark days of Franco’s authoritarianism if the right did.

Voters responded to the politics of fear with one of their highest turnouts since Spain’s return to democracy in the 1970s — 76 percent — mostly to confirm their attachment to a left-wing social agenda and to the country’s regional diversity.

The vote also gave Vox, an anti-immigration party, its first seats in Parliament — the crossing of a significant threshold for Spain, a country in which nationalism was long stigmatized by the legacy of the Franco dictatorship.

Vox’s national debut showed that Spain was not immune to the advance of far-right parties that have made inroads elsewhere in Europe. But the emergence of Vox did as much or more to mobilize its opponents on the moderate left.