"Difficult times are coming," Mariano Rajoy, 56, said in a televised victory speech in Madrid after his Popular Party won 186 seats and a governing majority in the 350-seat lower house of Parliament, while the governing Socialists plummeted to 110 seats from 169.
It was the Popular Party's best showing -- and the Socialists' worst -- since Spain's return to democracy in 1977.
"It is no secret to anyone that we are going to rule in the most delicate circumstances Spain has faced in 30 years," he said.
"There will be no miracles, and we haven't promised them, but when things are well done, results arrive," he said.
But he said Spain stands "at a crossroads" and the "decisive" choices it makes in the coming months "will shape the future of this great country, not just in the next few years but the next few decades."
Rajoy, who campaigned on promises of major reforms, more austerity and strict deficit control -- as well as tightening access to abortion -- takes over as prime minister next month.
In 2004 and 2008 he lost to current Prime Minister Jose Luis Rodriguez Zapatero, whose government was undone by the evaporation of Spain's economic boom after the world financial crisis took hold.
Spain was originally to hold elections in March, but the brunt of the debt crisis -- and a dramatic economic slump that has left 23 percent of Spaniards out of work -- forced Zapatero to move up the date and forgo a campaign for re-election himself.
Alfredo Perez Rubalcaba, Zapatero's 60-year-old former interior minister, led the Socialists in the campaign instead.
Economists say Rajoy must reduce the debt by at least $25 billion next year. Spain's sovereign-debt bond yields last week approached levels at which Portugal and Greece needed bailouts.
Spain is the third southern European country in two weeks to have a government fall under the weight of the eurozone debt crisis. Italian and Greek prime ministers were forced out by similar economic woes and gave way to interim "unity" governments of technical experts charged with taking urgent but unpopular austerity measures and then calling new elections.
In Spain, for the first time in decades, residents voted Sunday without the threat of violence from Basque separatist group ETA, which declared an end to 40 years of terrorism last month.
Basque voters turned out in large numbers and sent seven separatist deputies from the 2-month-old nationalist Amaiur party to Parliament.
The Catalan nationalist party that governs Spain's northeastern Catalonia region also won parliamentary seats.