Supporters of conservative Popular Party wave party and spanish flag next to their party headquarter in Madrid on Sunday. Spaniards braving 21.5 percent unemployment and bleak prospects for economic growth voted Sunday in a general election expected to yield a landslide win for opposition conservatives. (Emilio Morenatti/AP)

Spanish conservatives won a resounding mandate at the polls Sunday, freeing them to make deep austerity cuts as they struggle to pull the country’s economy out of a tailspin.

In an election marked by bitter disappointment and desperation over the euro zone’s highest unemployment rate, the Socialists who have led the country since 2004 were cast from office in their worst showing in the modern era of Spain’s democracy.

Conservatives won 186 of the 350 seats in parliament; the Socialists won 110. But the sharp swing was more a result of millions of voters abandoning the Socialists for smaller parties, not conservatives picking up new voters, suggesting a country more dispirited with the policies of the past than excited about the future.

The leader of the conservatives, Mariano Rajoy, 56, will not take over for another month, but he is widely expected to announce his economic team and strategy in the coming days.

“It is times like these that measure what men and societies are made of,” Rajoy said Sunday in his victory speech. “Our destiny is to play a big role in and with Europe. We will be more loyal but also more demanding. . . . There aren’t going to be any miracles, but we didn’t promise them.”

Sunday’s vote gives Europe another leader closely aligned with the austerity-based consensus that the continent’s strongest economies say is the solution to what plagues the weaker ones. In recent weeks, leaders in Italy and Greece have been forced from their perches.

Still, Rajoy may have limited influence over problems that have spread to France, Austria and the Netherlands — countries long associated with fiscal discipline and economic power — which saw their borrowing costs spike last week. France has called for continent-wide solutions more radical than those applied so far, including the printing of more money to prop up struggling countries, something Germany staunchly opposes.

In Spain, Socialist Prime Minister Jose Luis Rodriguez Zapatero had abandoned many of his party’s historic positions to implement budget cuts aimed at getting the country’s finances under control. But they did little to head off the nation’s 22.6 percent unemployment rate.

Last week, Spain’s borrowing costs spiked to their highest level since 1997, and one of Rajoy’s first tasks will be to soothe investors’ fears about his country’s viability.

Rajoy’s challenger, Alfredo Perez Rubalcaba, 60, seemed to accept defeat long before the election was held. Zapatero decided earlier this year not to stand for reelection.

“Countries like Spain are on the brink,” said Fernando Fernandez, an economist and former International Monetary Fund official who teaches at IE Business School in Madrid. “This government will have the moral authority” to make changes, he said.

Fernandez said that in addition to another round of budget cuts, he expected the new government would overhaul the labor market to make it easier to hire and fire workers, which could help create jobs in the long term but might add to joblessness in the immediate future.

Rajoy, an unflashy former cabinet minister who has led his People’s Party since 2004, had tried twice before to win Spain’s top job. The third time, he has been the beneficiary of a terrible economy.

“Rajoy isn’t charismatic at all,” said Narciso Michavila, who runs the polling firm GAD3. “But in this moment, that’s precisely his strength. He’s this boring guy, but you can rely on him.”

By many measures, Spain has been a model when compared with Italy and Greece, where political gridlock is still impeding any economic changes. But that has not helped avert the country’s troubles. Spain experienced a real estate bubble, comparable with the most recent one in the United States, that led to high levels of household debt and bad balance sheets at banks when it burst two years ago. Industries that previously powered the economy, such as construction, are now virtually nonexistent, pushing unemployment over 40 percent among workers ages 15 to 24.

Voters Sunday had little enthusiasm for the election, and many said they saw little difference between the two main parties. The Socialists had 4 million fewer votes than in the 2008 election. The conservatives gained just over 500,000 compared with their previous results.

“They’re the same dog with a different collar,” said Rosario Gomez, 43, a housecleaner who lives in the working-class Vallecas neighborhood of Madrid. “I work less and less, and I have less and less money.”

Special correspondent Pamela Rolfe contributed to this report.