As Spain prepares for elections, some liberal European politicians fear that the hard-right Vox party could become the first right-wing party since the Franco era to enter Spain’s national government.Last month, after Spain’s conservative and hard-right parties crushed the left in local elections, the winners in Elche, a small southeastern town known for an ancient sculpture and shoe exports, signed an agreement with consequences for the future of Spain — and the rest of Europe.The candidate from the conservative Popular Party had a chance to govern, but he needed the hard-right Vox party, which, in return for its support during council votes, received the deputy mayor position and a new administrative body to defend the traditional family. They inked their deal under the cross of the local church.“This coalition model could be a good model for the whole of Spain,” said Pablo Ruz Villanueva, Elche’s new mayor, referring to upcoming national elections on July 23, which most polls suggest will oust the liberal prime minister, Pedro Sánchez, of the Spanish Socialist Workers’ Party. The new deputy mayor from Vox, Aurora Rodil Martínez, went further: “My party will do everything that’s necessary to make that happen.”If Ms. Rodil’s wish comes true, with Vox joining a coalition with more moderate conservatives, it would become the first right-wing party since the dictatorship of Francisco Franco to enter the national government.The rise of Vox is part of an increasing trend of hard-right parties surging in popularity and, in some cases, gaining power by entering governments as junior partners.People walking through the old part of Elche, Spain.Samuel Aranda for The New York TimesThe parties have differences but generally fear the economic ramifications of globalization, and say that their countries will lose their national identities to migration, often from non-Christian or nonwhite-majority countries, but also to an empowered European Union that they believe looks after only the elites. Their steady advances have added urgency to a now pressing debate among liberals over how to outflank a suddenly more influential right.Some argue that the hard right needs to be marginalized, as was the case for more than a half-century after World War II. Others fear that the hard right has grown too large to be ignored and that the only choice is to bring them into governing in the hopes of normalizing them.In Sweden, the government now depends on the parliamentary votes of a party with neo-Nazi roots, and has given it some sway in policymaking. In Finland, where the right has ascended into the governing coalition, the nationalist Finns party has risked destabilizing it, with a key minister from that far-right party resigning last month after it emerged that he had made “Heil Hitler” jokes.On Friday, the Dutch government led by Mark Rutte, a conservative and the Netherlands’ longest serving prime minister, collapsed because more centrist parties in his coalition considered his efforts to curb migration too harsh. Mr. Rutte has had to guard his right flank against surging populists and a longstanding hard-right party.In Italy, the far right has taken power on its own. But so far, Prime Minister Giorgia Meloni, politically reared in parties born from the ashes of Fascism and a close ally of Spain’s Vox, has governed more moderately than many in Europe expected — bolstering some analysts’ argument that the reality of governing can be a moderating force.Elsewhere, hard-right parties are breaking through in countries where they had recently seemed contained.Elche’s new mayor, Pablo Ruz Villanueva, left, and deputy mayor, Aurora Rodil Martínez, in their office last month in Elche, Spain.Samuel Aranda for The New York TimesIn France, the once fringe party of the far-right leader Marine Le Pen has become an established force as entrenched anger against President Emmanuel Macron has newly exploded over issues like pension changes and the integration and policing of the country’s minority communities. He is not running again and the election is years away, but liberals across Europe shuddered when she passed him in some recent polls.And in Germany, where the right has long been taboo, economic uncertainty and a new surge in arrivals by asylum seekers has helped resurrect the far-right Alternative for Germany party. It is now the leading party in the formerly Communist eastern states, according to polls, and is even gaining popularity in the wealthier and more liberal west.While the parties in different countries do not have identical proposals, they generally want to close the doors to and cut benefits off for migrants; hit the pause, or reverse, button when it comes to L.G.B.T.Q. rights; and stake out more protectionist trade policies. Some are suspicious of NATO and dubious about climate change and sending arms to Ukraine.Supporters of the hard-right Italian politician Giorgia Meloni in Rome before the general elections that she won in 2022.Gianni Cipriano for The New York TimesIn a seeming recognition that the continent’s political complexion is changing, the European Commission president, Ursula von der Leyen, said in Spain this past week that the European Union needed to deliver tangible results in order to counter “extremist” forces.In Spain, where the conservative Popular Party has a good chance of finishing first in the coming election, Esteban González Pons, a leading party official, said that bringing hard-right parties, like Vox, into government was a way to neutralize them. But he acknowledged that strategy carried risks.“First, the bad scenario: We can legitimize Vox,” he said.“Then, there is a second chance: We can normalize Vox,” he said, adding that if they governed well, “Vox will be another party, a conservative party inside of the system.”For now, the situation is fluid and there are indications that Mr. Sánchez and his leftist allies are gaining support. Vox also appears to be losing ground as the Sánchez campaign and well-known artists and liberals throughout Spain have focused on the threat of conservatives bringing Vox into the government.A Pride flag hanging on a house in Náquera, Spain.Samuel Aranda for The New York TimesSpain seemed in recent years to be a bright spot for liberals. Under Mr. Sánchez, Spain has kept inflation low, reduced tensions with separatists in Catalonia, and increased the growth rate, pensions and the minimum wage. He is also generally popular in the European Union.But the alliance between Mr. Sánchez and deeply polarizing separatists and far-left forces has fed resentment among many voters.Mr. González Pons, a leading official of the Popular Party, does not think that worries about Vox possibly joining forces with his conservatives are entirely off base. “We are pro-European and Vox is not,” he said, adding that Vox “would prefer something like a general Brexit, for all the countries to recover their own sovereignty.” He said Vox had views on gay rights and violence against women that “are red lines for us.”Those lines started to show as the new leaders of Elche sat on leather armchairs in the mayor’s office last week and sought to put up a united front. Mr. Ruz, the mayor from the conservative Popular Party, and his deputy from Vox, Ms. Rodil, took turns bashing the prime minister. But when pressed, the mayor acknowledged that his party recognized gay marriage, and that he was queasier about hard-right parties like Alternative for Germany than his “partner.” Still, he said, the Popular Party and Vox had similar voters, just different approaches to “implementation.”Far-right supporters of Spain’s Vox party during a recent rally in Barcelona.Samuel Aranda for The New York Times“Can I say something regarding that?” Ms. Rodil said with a coy smile. “We have a stance that is maybe a little firmer.” Vox, she said, believes in the “sovereignty of nations” and would like to make it more difficult for women to have abortions, positions that she said some people in the mayor’s party “do not defend.” She said the “ambiguous” stances of Alberto Núñez Feijóo, the Popular Party’s leader, were “worrying.”Many, instead, are worried about Vox.“We have seen populism, supported by the center-right, grow in small towns,” said Carlos González Serna, the former socialist mayor of Elche, who lost the election. He said that instead of cordoning off the extreme right, mainstream conservatives had given it an “umbilical cord” of legitimacy.The leader of Vox, Santiago Abascal, split from the Popular Party amid a slush-fund scandal in 2013. The party’s popularity grew in 2018 as more migrants arrived by sea to Spain than to any other European country. The nationalist Vox was also well positioned to exploit a backlash to the Catalonian independence movement.But Vox has also found support among Spaniards unhappy with their country’s progressive shift on climate change and social issues, including gay rights and feminism. Their campaign billboards have included candidates throwing L.G.B.T.Q., feminist and other symbols in the trash. In the town of Náquera, near Elche, the newly elected mayor from the Vox party has ordered the removal of Pride flags from municipal buildings.Migrants having breakfast on a rooftop in 2018 in Barcelona. That year, more migrants arrived by sea to Spain than to any other European country.Samuel Aranda for The New York TimesOne resident, a 45-year-old truck driver named Maximo Ibañez, said he voted for Vox because the party spoke clearly, but also because he feels that Spain’s pioneering laws to explicitly protect women against gender-based violence — complete with special courts and tougher sentences — discriminate against men.“It’s women who have the right to presumption of innocence here,” he said.One of Vox’s regional leaders has joked that some women were too unattractive to be gang raped, and another said that “women are more belligerent because they don’t have penises.”Ms. Rodil, the new deputy mayor of Elche with Vox, said that her party had no quarrel with women, just with the notion that domestic violence should be seen through gender-based ideology, and that a man, “just for being a man, is bad, that he has a gene that makes him violent.”She argued that Mr. Sánchez’s government had endangered women with botched legislation that had the potential to let sex offenders out of jail. Mr. Sánchez has apologized for the inadvertent effects of the so-called yes-is-yes law, which was intended to categorize all non-consensual sex as rape, but which, through changes to sentencing requirements, has risked reducing jail time or setting free potentially hundreds of sex offenders.As many in Europe say the time has come to start taking right-wing parties more seriously, some voters in Elche regretted not having taken Vox seriously enough.“I didn’t think that they were going to form a government and the fact that they have has surprised me,” Isabel Chinchilla, 67, said in a plaza that features three statues of the Virgin Mary. “I will vote in the national elections so that this doesn’t happen again, because they are very reactionary in their vision of society.”Maximo Ibañez, right, a truck driver who said he voted for Vox, at a bar in Náquera, Spain.Samuel Aranda for The New York TimesRachel Chaundler More