(Updates with most ballots counted)
By Martin Roberts
MADRID, March 1 Spain's governing Socialists were set to lose power in one region but possibly gain it in another on Sunday, in their first electoral test since the economy sank into recession last year and unemployment soared.
With 98 percent of ballots counted in northwesterly Galicia, Prime Minister Jose Luis Rodriguez Zapatero's party was on course to cede control back to the conservative main opposition party, the Popular Party, after heading a government there for four years.
But in the Basque Country, it appeared to have secured a chance of ousting the Basque Nationalist Party (PNV), which has been in power there since 1980.
With 99.9 percent of ballots tallied, the PNV had the biggest share of the vote, but Zapatero's party appeared set to increase its share to 25 seats from the 18 it won in 2005.
With the PP set to get 13 seats, a majority coalition in the 75-seat regional Basque assembly between the two main national parties appeared to be a possibility, although they are likely to make uneasy bedfellows.
The Socialists won a national election a year ago when the economy was cooling as a decade-long housing boom ended. Unemployment has since jumped to 14 percent and the economy has gone into recession.
Campaigning for both major parties was overshadowed by a corruption probe in which members of the PP were implicated.
The Socialist justice minister resigned on Monday after news emerged that he had been on a hunting trip with the high-profile judge leading the corruption investigation.
Analysts say the corruption case helps to explain why the PP has failed to make inroads into Socialist support in national opinion polls, despite the economic crisis.
Victory in Galicia would come as a boost for PP leader Mariano Rajoy, who had campaigned energetically in the region.
His PP increased their representation to 39 seats from 37, just enough for a majority in the 75-seat house.
The Socialists, who had governed in coalition with Galician nationalists, slipped to 24 seats from 25.
Rajoy struggled to retain leadership of the PP after losing his second national election, and he has failed to capitalise on discontent about the recession.
Basque politics has often been marred by violence, and suspected ETA rebels planted a bomb at a Socialist office in the region on Monday.
On Friday, an ETA statement said the elections were "anti-democratic" for excluding left-wing pro-independence parties. (Reporting by Martin Roberts; Editing by Kevin Liffey)