Supporters of Spanish Prime Minister and Socialist Party candidate Pedro Sanchez gather at the party headquarters waiting for results of the general election in Madrid, Sunday, April 28, 2019. Spain's governing Socialists won the country's national election Sunday but will need the backing of smaller parties to stay in power, while a far-right party rode a groundswell of support to enter the lower house of parliament for the first time in four decades, provisional results showed. At left is his wife Maria Begona Gomez. (AP Photo/Andrea Comas)

MADRID (AP) — The latest on the Spanish national election (all times local):

5:05 a.m.

Spain's governing Socialist Party has won the country's parliamentary election but will need backing from smaller parties to stay in power. And for the first time since the 1970s, a far-right party will have members in Spain's lower house of parliament.

With nearly all ballots counted from Sunday election, the Socialists headed by Prime Minister Pedro Sánchez won nearly 29% of the votes. They captured 122 seats in the 350-seat Congress of Deputies.

The new far-right Vox party won 10% of the vote and will have 24 seats. Its success came at the expense of the once-dominant conservative Popular Party, which fell to 66 seats

The Popular Party lost votes both to Vox and to the center-right Citizens party, which will increase its number of seats from 32 to 57.

___

1:05 a.m.

Spain's socialist prime minister says he will consider talks to form a new government only with parties that respect the constitution and promote social justice.

Pedro Sánchez declared his party the winner in Sunday's general election, a ballot in which the far-right made inroads for the first time since Spain returned to democratic rule.

Sánchez hinted at a preference for a left-wing governing alliance but his stress on the constitution also sent a warning to Catalan separatists even though he may need their support to be elected by Parliament's lower house to a new term as prime minister.

Spain's constitution says regions have no right to secede and sovereignty must be decided by all Spaniards, not just by inhabitants of a particular region. Catalan separatists defied Spain in 2017 with a referendum and subsequent independence declaration. They won 22 seats Sunday.

___

12:40 a.m.

The leader of Spain's conservatives is acknowledging that Sunday's election results for his Popular Party are "very bad" — its worst showing ever in a national vote.

Pablo Casado also told his Popular Party members Sunday night that "we have been losing our electoral support for several elections."

According to provisional results, the Popular Party will see its number of seats in Parliament shrink to 66 from the 137 it won in the 2016 elections.

Casado blames the debacle on the splitting of voters on the right, with many being lured away by the center-right Citizens party and the new far-fight Vox party.

The Socialist Party of Prime Minister Pedro Sánchez replaced the Popular Party as the biggest vote getter and is poised to stay in power.

___

11:45 p.m.

The leader of the United We Can anti-austerity party in Spain says that it has already offered the incumbent prime minister Pedro Sánchez his desire to form a left-wing coalition government.

Pablo Iglesias spoke with provisional results in the country's third election in four years gave the victory to the ruling Socialist Party but short of a parliamentary majority.

He said "we would have liked a better result, but it's been enough to stop the right-wing and build a left-wing coalition government."

United we Can, whose name in Spanish is Unidas Podemos, won 35 seats, 10 less than in the previous national election, in 2016. Iglesias blamed the result on the party's internal leadership fights.

He said the negotiations for possible pacts will last a long time.

___

11:35 p.m.

Vox leader Santiago Abascal has euphorically celebrated his new far-right party's results in Spain's general election.

Abascal has told supporters in central Madrid that he blames the once-dominant conservative Popular Party for not being able to garner enough votes for the right-wing to oust incumbent Prime Minister Pedro Sánchez.

Abascal gave a thumbs-up sign to celebrate his party's showing as confetti in the party's green and white colors showered down.

He said "we told you that we were going to begin a reconquering of Spain and that's what we have done." That is a reference to the 15th-century campaign by Spanish Catholic Kings to end Muslim rule on the Iberian Peninsula.

The 43-year-old Abascal said that the 24 lawmakers from Vox that will sit in Spain's lower house of parliament will be enough for the party to set the political agenda.

He said that the lawmakers "will ask those things that preoccupy Spaniards."

Vox, which was formed five years ago, has promised to defend Spain from its "enemies," citing feminists, liberal elites and Muslims among others.

___

11:15 p.m.

Spain's government spokeswoman says the Socialist party has won the country's general election with nearly all votes counted.

The result means that Prime Minister Pedro Sánchez will be able to enter negotiations for a governing alliance with the far-left United We Can Party, whose leader has offered to share a coalition Cabinet.

Both parties still need the votes of around 15 more lawmakers for Sánchez to be able to stay in office.

Government spokeswoman Isabel Celaa said that the incumbent party of Sánchez received nearly 7 million votes, which results in 122 seats in the lower house of parliament.

___

11 p.m.

Vox general secretary Javier Ortega Smith has told supporters that "today is historic" after the new far-right party won its first seats in the Spain's parliament.

Provisional results give 24 seats to Vox in the lower chamber after Sunday's election, with the Socialists taking the most votes.

Ortega Smith says that "this is an ephemeral victory since the left knows that with Vox their party is over."

Ortega Smith adds: "the resistance is now in the Congress, and starting tomorrow millions of Spaniards that have been silenced with have a voice in Congress."

___

10:40 p.m.

Spain's once-dominant conservative Popular Party is on track to lose more than half of its parliamentary seats amid far-right gains in the general election.

The conservative Popular Party, or PP, was once the leading force in parliament but will likely win only 65 seats — less than get half of its 2016 haul of 137 seats, according to partial results with about 90 percent of votes counted.

The PP's influence has been diluted by the far-right Vox party, which looks set to make a strong entrance into parliament's lower house with 24 lawmakers, according to the partial results. PP also lost votes to the center-right Citizens party, which will increase its number of seats from 32 to 57.

The Socialists are poised to become the most voted party since 2008, but will need to make pacts with other parties to remain in office.

___

10 p.m.

Partial results in Spain's election show the incumbent Socialists winning the most votes in the general election but falling well short of a majority. The far-right, meanwhile, has made strong gains.

The provisional results, with 50% of the ballots counted, show that Prime Minister Pedro Sánchez's party has won 126 seats and the far-left United We Can got 35. That is still 15 seats short of the 176 majority in the 350-member lower house.

If the results stand, that would mean Sánchez would also need to rely on smaller parties and separatists to stay in office.

The right-wing bloc would be short of a majority, according to the partial results. With 67 seats, the once-dominant Popular Party has lost almost half of its presence in the Congress of Deputies, losing votes to the center-right Citizens party, which grabbed 53 seats and far-right party Vox won 23.

Spain's Interior Ministry says that turnout was over 75%, well above the average in the previous 12 elections since Spain returned to democratic rule.

___

8 p.m.

Polls have closed in most of Spain in an election with one of the highest turnout levels in recent years amid division over the role that the far-right could play in influencing the country's politics.

Participation in Sunday's election was more than 9% higher than during the 2016 vote, especially in the northeastern region of Catalonia, two hours polls closed.

Spanish media showed long lines still in many of the polling stations at 1800 GMT (2 p.m. EDT), when all voting is supposed to end everywhere but the Canary Islands, where voting finishes one hour later.

___

6:30 p.m.

Voter turnout in Spain's general election is over 9% higher than during the 2016 vote, especially in the northeastern region of Catalonia.

Two hours before the polls close Sunday, Spain's Interior Ministry says nearly 60.8% of all eligible voters have already cast their ballots, up from 51.2% at the same time in the 2016 election.

In Catalonia, turnout is up to 64.2% from nearly 46.4% in 2016. This is the first national election since the region's failed secession attempt in 2017.

In southern Andalusia, Spain's most populous region, turnout has risen to nearly 57.3% from nearly 50.3%. Right-wing parties won Andalusia's regional election in December, ending the ruling Socialists' long-time hold on the region.

A highly polarized campaign that included rising support for the far-right nationalist Vox party and an uncertain result Sunday appear to have motivated voters.

___

4:10 p.m.

Turnout is soaring in restive Catalonia as voters go to polling stations in much higher numbers for Spain's first national election since the northeastern region's failed secession attempt in 2017.

The Spanish Interior Ministry says that by 2 p.m. (1200 GMT), voter turnout in Catalonia is more than 11% higher than in 2016 elections, up from 32.31% to 43.52%.

Sunday's election comes during the ongoing trial of 12 leaders of Catalonia's secession bid who are facing charges including rebellion. Five of those defendants are running in the election from inside a jail cell.

Imma Margalef, a 60-year-old administrative assistant, says in Barcelona that she has voted for the pro-secession Republican Left for the first time because "I think it is unfair that they have put these people in jail."

Pilar Olivar, a 62-year-old marine biologist, is against Catalonia seceding and says she has voted for the ruling Socialists to keep the right-wing parties from returning to power.

___

3 p.m.

Spain's Interior Ministry says turnout for Sunday's national election so far is 4% higher than the previous ballot.

The ministry says, as of 2 p.m. (1200 GMT), 41.5% of all eligible voters have already cast their ballots Sunday, up from 36.9% at the same time in the 2016 election.

Prime Minister Pedro Sánchez's Socialist party is favored to get the most votes, but it is expected to fall far short of a majority. The right-wing in Spain, long dominated by the conservative Popular Party, has now split into three groups, including the Citizens party and the far-right nationalist Vox party.

The uncertain outcome includes the likelihood that a far-right party could enter Parliament for the first time since the 1980s.

Polls close at 8 p.m. (1800GMT) for the nearly 37 million Spaniards allowed to vote.

___

12:35 p.m.

The leader of Spain's conservative opposition says that Sunday's general election is perhaps the country's "most decisive" in recent years.

Minutes after casting his vote in a polling station at a Madrid school, Popular Party leader Pablo Casado told reporters that he wishes for a stable government to emerge from the ballot.

Santiago Abascal, the leader of the first far-right party likely to grab a significant number of parliamentary seats since the 1980s, also voted in a public school in the Spanish capital.

"Millions of Spaniards are going to vote with hope. They are going to do it without fear for anything or anybody," he told cameras.

Vox, which has revived Spanish nationalism in response to separatist and liberal-minded movements, posted a tweet with a picture adapted from a battle in HBO's Game of Thrones series. A sword-wielding Vox warrior faces a wall of enemies carrying the symbols of Vox's political opponents: media organizations seen by the party as unfavorable and feminist and gay rights logos.

"Let the battle start, #ForSpain" the tweet said.

___

12:25 p.m.

Alicia Sánchez, 38, and her mother cast their ballots in Spain's general election at the Palacio Valdes public school in central Madrid "in order to stop the racist extreme right" from making a significant power grab.

"I've always come to vote, but this time it feels special. I'm worried about how they can influence policies on women and other issues. They are clearly homophobic. Reading their program is like something from 50 years ago. I'm scared," Sánchez said Sunday.

Minutes later, Amelia Gómez and Antonio Román, she 86 and he 90, emerged from the crowd flocking to the polling station.

Having voted in all elections since Spain returned to democratic rule four decades ago, following the dictatorship of Gen. Francisco Franco, the couple they didn't have much trust in politicians.

"All I want is for whoever wins to take care of the old people," Gómez said, complaining that the two of them together receive less than 1,000 euros (1,100 euros) a month in state pensions.

"They need to watch for the poor, that's their job," Román added.

___

10:30 a.m.

The five top candidates to become Spain's next prime minister are casting their ballots and encouraging people to take advantage of the sunny spring day to come out and ensure a high turnout in Sunday's general election.

All are voting in the Spanish capital except for the center-right Citizens party leader, Albert Rivera, who cast his ballot in a town near Barcelona.

Rivera, who has focused his campaign on unseating the incumbent Socialist prime minister, told reporters that a high turnout is needed for a government change and to "usher in a new era."

Pablo Iglesias, the leader of the left-wing United We Can party, also stressed the importance of voting on Sunday.

"My feeling is that in Spain there is an ample progressive majority, and when there is high participation that becomes very clear," Iglesias told reporters at a public school in the residential suburb near Madrid where he lives.

___

9:45 a.m.

Spanish Prime Minister Pedro Sánchez says he wants Sunday's highly contested general election to yield a parliamentary majority that can undertake social and political reforms in the country.

Surrounded by cameras and accompanied by his wife, the 47-year old incumbent Socialist leader cast his ballot early on Sunday at a cultural center in an affluent suburban neighborhood of the Spanish capital.

He was the first of the five top candidates to vote in the general election marked by the rise of a far-right party and the high number of undecided voters.

All polls forecast that Sánchez's Socialists will overtake the conservative Popular Party to garner the most votes, but Sánchez will be nowhere near a majority in the parliament's Lower House.

Up for grabs are the 350 members of the Congress of Deputies, who then choose a government, and also 208 senators for the Upper House.

___

9:05 a.m.

A divided Spain is voting in its third general election in four years, with all eyes on whether the rise of conservative nationalism will allow the right wing to unseat the incumbent prime minister.

Pedro Sánchez is set to win the most votes, but his Socialists seem far from scoring a majority in parliament to form a government on their own.

The fragmentation of the political landscape is the result of austerity that followed the economic recession, disenchantment with bipartisan politics and the recent rise of far-right populism.

Sánchez called Sunday's ballot after a national budget proposal was rejected in the Lower Chamber by the center-right-conservative opposition and Catalan separatists pressing for self-determination in their northeastern region.

Voting stations opened at 9 a.m. (0700GMT) Sunday and will close at 8 p.m. (1800GMT), with results expected a few hours later.

People line up outside a polling station to cast their vote for the general election in Barcelona, Spain, Sunday, April 28, 2019. Galvanized by the Catalan crisis, Spain's far right is set to enter Parliament for the first time in decades while the Socialist government tries to cling on to power in Spain's third election in four years. (AP Photo/Emilio Morenatti)
In this Podemos party handout picture, Podemos, United We Can, party leader Pablo Iglesias, casts his ballot for the general election in Madrid, Spain, Sunday, April 28, 2019. Galvanized by the Catalan crisis, Spain's far right is set to enter Parliament for the first time in decades while the Socialist government tries to cling on to power in Spain's third election in four years. (AP Photo/Podemos via AP)
Santiago Abascal, leader of far right party Vox, gestures supporters gathered outside the party headquarters following the general election in Madrid, Sunday, April 28, 2019. A divided Spain voted Sunday in its third general election in four years, with all eyes on whether a far-right party will enter Parliament for the first time in decades and potentially help unseat the Socialist government. (AP Photo/Manu Fernandez)
Supporters of Spanish Prime Minister and Socialist Party candidate Pedro Sanchez react as they gather at the party headquarters waiting for results of the general election in Madrid, Sunday, April 28, 2019. A divided Spain voted Sunday in its third general election in four years, with all eyes on whether a far-right party will enter Parliament for the first time in decades and potentially help unseat the Socialist government. (AP Photo/Andrea Comas)
Supporters of far right party Vox cheer as the party Secretary General Javier Ortega Smith addresses them outside the party headquarters while waiting for results of the general election in Madrid, Sunday, April 28, 2019. A divided Spain voted Sunday in its third general election in four years, with all eyes on whether a far-right party will enter Parliament for the first time in decades and potentially help unseat the Socialist government. (AP Photo/Manu Fernandez)
Popular Party's leader Pablo Casado talks to journalists outside a polling station after voting in Spain's general election in Madrid, Sunday, April 28, 2019. Galvanized by the Catalan crisis, Spain's far right is set to enter Parliament for the first time in decades while the Socialist government tries to cling on to power in Spain's third election in four years. (AP Photo/Paul White)
A woman casts her vote at a polling station for the general election in Pamplona, Spain, Sunday, April 28, 2019. A divided Spain is voting in its third general election in four years, with all eyes on whether a far-right party will enter Parliament for the first time in decades and potentially help unseat the Socialist government. (AP Photo/Alvaro Barrientos)
People line up to cast their votes during Spain's general election in a polling station in Barcelona, Spain, Sunday, April 28, 2019. A divided Spain is voting in its third general election in four years, with all eyes on whether a far-right party will enter Parliament for the first time in decades and potentially help unseat the Socialist government. (AP Photo/Emilio Morenatti)
Spanish Prime Minister and Socialist Party candidate Pedro Sanchez, right, leaves a polling station after casting his vote during Spain's general election in Pozuelo de Alarcon, outskirts of Madrid, Sunday, April 28, 2019. Spain's Prime Minister Pedro Sánchez says he wants Sunday's highly contested general election to yield a parliamentary majority that can undertake social and political reforms in the country. (AP Photo/Bernat Armangue)
Spanish Prime Minister and Socialist Party candidate Pedro Sanchez casts his vote inside a polling station during Spain's general election in Pozuelo de Alarcon, outskirts of Madrid, Sunday, April 28, 2019. An uncertain outcome and the likelihood of the far right erupting into Spain's Parliament looms over national elections on Sunday, when nearly 37 million Spaniards are called to cast ballots in the most highly polarized election in decades. (AP Photo/Bernat Armangue)
People cast their vote during Spain's general election in a polling station in Barcelona, Spain, Sunday, April 28, 2019. A divided Spain is voting in its third general election in four years, with all eyes on whether a far-right party will enter Parliament for the first time in decades and potentially help unseat the Socialist government. (AP Photo/Felipe Dana)
A man casts his vote at a polling station for the general election in Pamplona, Spain, Sunday, April 28, 2019. A divided Spain is voting in its third general election in four years, with all eyes on whether the rise of conservative nationalism will allow the right wing to unseat the incumbent prime minister. (AP Photo/Alvaro Barrientos)
People line up outside a polling station to cast their vote for the general election in Barcelona, Spain, Sunday, April 28, 2019. Galvanized by the Catalan crisis, Spain's far right is set to enter Parliament for the first time in decades while the Socialist government tries to cling on to power in Spain's third election in four years. (AP Photo/Emilio Morenatti)
People arrive at a polling station to cast their votes for the general election in the small village of Tafalla, around 38 kms (23,6 miles) from Pamplona, Spain, Sunday, April 28, 2019. A divided Spain is voting in its third general election in four years, with all eyes on whether a far-right party will enter Parliament for the first time in decades and potentially help unseat the Socialist government. (AP Photo/Alvaro Barrientos)
A woman leaves a booth after casting her vote, at a polling station, during the general election in the small village of Tafalla, around 38 kms (23,6 miles) from Pamplona, Spain, Sunday, April 28, 2019. A divided Spain is voting in its third general election in four years, with all eyes on whether a far-right party will enter Parliament for the first time in decades and potentially help unseat the Socialist government. (AP Photo/Alvaro Barrientos)
People line up to cast their votes during Spain's general election in a polling station in Barcelona, Spain, Sunday, April 28, 2019. A divided Spain is voting in its third general election in four years, with all eyes on whether a far-right party will enter Parliament for the first time in decades and potentially help unseat the Socialist government. (AP Photo/Emilio Morenatti)
A girl peeks out of a booth as people cast their votes, at a polling station, during the general election in the small village of Tafalla, around 38 kms (23,6 miles) from Pamplona, Spain, Sunday, April 28, 2019. A divided Spain is voting in its third general election in four years, with all eyes on whether a far-right party will enter Parliament for the first time in decades and potentially help unseat the Socialist government. (AP Photo/Alvaro Barrientos)
People queue to vote at a polling station for Spain's general election in Madrid, Sunday, April 28, 2019. Galvanized by the Catalan crisis, Spain's far right is set to enter Parliament for the first time in decades while the Socialist government tries to cling on to power in Spain's third election in four years. (AP Photo/Andrea Comas)
Santiago Abascal, center left, leader of far right party Vox, leaves a polling station after voting in Spain's general election in Madrid, Sunday, April 28, 2019. Galvanized by the Catalan crisis, Spain's far right is set to enter Parliament for the first time in decades while the Socialist government tries to cling on to power in Spain's third election in four years. (AP Photo/Andrea Comas)
People check voting sections lists next to a banner celebrating World Autism Day with the words
A damaged separatist poster decorates a wall near a polling station on the day of the general election in Badalona, Spain, Sunday, April 28, 2019. A divided Spain is voting in its third general election in four years, with all eyes on whether a far-right party will enter Parliament for the first time in decades and potentially help unseat the Socialist government. (AP Photo/Felipe Dana)