The conservative leader of Spain's Madrid region has won a resounding victory after a bitter election battle.
Despite more than doubling the Popular Party (PP) seats, Isabel Díaz Ayuso still fell short of a majority and may end up in alliance with the far right.
She defied the Socialist-led central government by keeping Madrid's bars and shops open throughout the pandemic.
There was high security following death threats against several candidates.
The acrimonious campaign highlighted the polarisation in Spanish politics.
Ms Ayuso won 44.7% of the vote, taking 65 seats in Madrid's 136-seat assembly. The three-party left bloc could only muster 58 seats between them.
While she initially described the vote as a choice between "socialism or freedom", her opponent Pablo Iglesias, from the left-wing Unidos Podemos (United We Can), spoke of a choice between "democracy or fascism", highlighting the potential involvement of the far-right Vox party in a future Madrid government.
Mr Iglesias had resigned as deputy to Spain's Socialist Prime Minister Pedro Sánchez to take on Ms Ayuso as his party's candidate. After Tuesday's vote result, he said he would quit politics altogether.
More than five million people were eligible to vote in Tuesday's election and turnout during the day was high as long queues formed outside polling stations.
Who is Isabel Díaz Ayuso?
Ms Ayuso, 42, has been an outspoken critic of the central government's handling of the pandemic, under the mantra of freedom, and she has fought against a number of its lockdown restrictions.
She is a rising star in the PP, which has governed Madrid for 26 years. Having studied journalism and political communication, she first joined the Madrid Assembly in 2011 before becoming its president in 2019.
Madrid's bars and restaurants were allowed to stay open while other regions continued to clamp down. No-one wanted curfews or states of emergency, she complained recently.
And yet the region around the capital still has Spain's second-highest infection rate and the highest number of patients in intensive care.
"Madrid is freedom and they don't understand our way of living, that's why Sánchez and his colleagues do not enter in Madrid," Ms Ayuso said in a speech after the result on Tuesday.
"Because it can't be directed, can't be controlled and things can't be imposed here. Because freedom means a person can start again a thousand times, give opportunities for young people and security for the elderly. That's freedom, and they wanted to take it away from us."
Spain has reported more than 3.5 million coronavirus infections and 78,399 deaths, according to Johns Hopkins University.
What does victory mean?
Ms Ayuso has been in power alongside the Ciudadanos (Citizens) party since 2019 but called early elections in March after their regional government collapsed.
Despite saying during the campaign that her party hoped to govern alone, without an absolute majority an alliance with Vox is a real possibility.
In an interview with El Mundo newspaper last month, she said her party and Vox were "different parties but have agreed on fundamental issues, and that will continue to be the case".
Even without a formal coalition her party could still rely on Vox's votes in the Madrid assembly to pass legislation.
But any agreement is likely to prove controversial outside the capital.
Ahead of the election, Prime Minister Sánchez warned that any pact between the PP and Vox "could be the beginning of the end of democracy". In 2019, Vox became the first significant far-right force to enter Spain's parliament in decades.
During the campaign ahead of Tuesday's vote, threatening letters containing bullets were sent to a number of candidates, including Ms Ayuso and Pablo Iglesias. However, Vox leader Rocío Monasterio said during the campaign that she did not believe Mr Iglesias' account.
Ayuso's Covid strategy pays off
Guy Hedgecoe, Madrid
Isabel Díaz Ayuso has taken a relatively relaxed approach to management of the pandemic. She has allowed bars and restaurants in Madrid to remain open in recent months, and Covid infection rates have been higher than in most other regions.
This strategy paid off at the ballot box as she more than doubled her party's seats. However, she has fallen short of a majority and will need the support of the far-right Vox party in order to govern.
It was a bad night for the Socialists of Spanish Prime Minister Pedro Sánchez, who suffered their worst-ever result in Madrid.
Meanwhile, the leader of the leftist Podemos, Pablo Iglesias, announced his resignation, after his party made only modest gains.