Spanish elections: Podemos and Ciudadanos make gains
Spain's new anti-corruption movements have made gains in local and regional elections, at the expense of traditional main parties.
With the count almost completed, the governing People's Party (PP) has won the most votes with 27%.
But it may have lost the Madrid city council for the first time in 20 years.
The Spanish economy has been a key concern for voters, and many are enraged over public spending cuts and reports of political corruption.
Prime Minister Mariano Rajoy's administration and the previous Socialist (PSOE) government are both seen as being to blame.
Spain has now officially come out of recession.
Six months before national elections, the ruling PP has gained the most votes, beating the Socialist party who came second with 25%.
But the two traditional parties fell short of overall majorities in most areas. They both lost a significant number of votes to emerging groups Ciudadanos and Podemos.
Analysis: Tom Burridge, BBC News, Madrid
As expected, in the wake of the economic crisis and high-profile corruption scandals which have tarnished the reputation of the traditional political parties in Spain, the country has now entered a new political era.
Anti-austerity parties, linked to the Podemos movement on the far left, which is barely one year old, have the prestige of holding power in Barcelona, and could form a coalition to rule in the Spanish capital.
Across the country the ruling Popular Party (PP) of Prime Minister Mariano Rajoy has been punished.
The PP will hold onto the fact that they still have the highest share of the vote of any single party. However, they have lost absolute majorities in regional parliaments across the country, including in traditional heartlands like Valencia, where the party has been badly damaged by corruption.
Barcelona in itself is an incredible story. The new mayor will be Ada Colau, a woman who made her name by campaigning for people who couldn't pay their mortgages, and who faced eviction by the banks after Spain's construction bubble burst.
In the capital Madrid, the PP won the municipal election but could still lose control of the city council.
The ruling party took 21 seats but Ahora Madrid, backed by the leftist anti-corruption party Podemos, took 20. Ahora Madrid could now form a coalition with the Socialists who came third.
Analysts say that similar deals could take place in a number of councils such as Valencia, further eroding the local power of the PP.
The ruling party may also need to make pacts of its own with the pro-business Cuidadanos party in places such as Murcia and La Rioja.
Spain is unfamiliar with governing coalitions as the PP and the Socialists have dominated for decades.
Anti-eviction activist Ada Colau, who is supported by Podemos, has also won the most votes in the mayoral race for Barcelona, Spain's second largest city.
"I want to be a mayor at the service of the people, so there will never again be first-class citizens and second-class citizens in this town," she said, as quoted by El Pais newspaper.
Last year was the first time there has been full-year economic growth in Spain since 2008, when a property bubble burst, putting millions of people out of work and pushing the country to the brink of a bail-out.
The government's labour reforms have reduced the cost of hiring and firing. However, unemployment remains high, with nearly one in four workers without a job.