If Greece's debt crisis is giving the European Union a headache, it is minor compared to the pain it will suffer if a large member state such as Spain sinks into similar trouble.

Spain has an unemployment rate of almost 20 percent, large deficits, a heavily indebted private sector, and weak prospects for growth -- which could make its debt a target for speculators if Athens' problems prove contagious in the euro zone.

A Greek debt default would increase pressure on the euro but the damage would likely be limited since Athens accounts for less than 3 percent of the 16-country currency area's GDP.

A Spanish debt crisis would be much harder for the EU to handle because its economy is the euro zone's fourth-largest, accounting for nearly 12 percent of euro-wide GDP.

Greece is a small country and at the end of the day its problems can be solved, said Cinzia Alcidi of the Center for European Policy Studies think tank in Brussels.

The big headache would be if the crisis spread from Greece to Portugal because the next one would probably be Spain. This would be a much bigger problem for the euro zone as a whole and it would be very difficult to solve.

EU states have not committed to any bailout for Greece but, with countries such as Spain in mind, are discussing creating a European monetary fund to offer help in any future crises. But even such a fund might struggle to cope in Spain's case.

If you talk about Spain, the money needed would be much more than in Greece's case and it's very difficult to see how they could collect such a huge amount of money, said Zsolt Darvas of the Bruegel think tank in Brussels.

COULD EU COPE WITH A CRISIS IN SPAIN?

EU officials have repeatedly expressed confidence, publicly and privately, that Spain can weather the storm, just as they have said Greece can get by without EU financial support.

They see Spain's handling of the economy as more reliable and conservative than that of Greece, which has been profligate and provided the 27-country bloc with false economic statistics.

But concern about contagion from Greece has prompted the EU to look for ways for euro zone countries to help each other out if they encounter problems servicing their debts. Under EU rules, neither the Union as a whole nor individual member states can assume the debts of other countries.

It is not about Greece any more. It is about setting up a new institution, a European diplomat said.

Another said: The euro zone can cope with Greece, or even Ireland defaulting, but not Spain. Something has to be done.

European officials say Spain should not be put in the same boat as Greece because Madrid does not face an imminent crisis, but they want to be prepared in case the worst happens.

Spain's problems are largely caused by a housing bubble that burst, hitting the construction sector on which the economy had become disproportionately dependent and leaving many people and companies with large debts.

The housing sector soared partly because of a credit boom caused, economists say, by interest rates that were too low for Spain as the European Central Bank looked mostly at the situation in Germany and France, the biggest economies.

Cheap credit also fueled inflation consistently higher than the euro zone average, undermining the competitiveness of many Spanish companies.

A QUESTION OF POLITICAL WILL

Much depends on the ability or willingness of Prime Minister Jose Luis Zapatero's government to implement austerity measures and to carry out reforms to fuel growth, boost productivity in the labor market and cut the cost of doing business.

I have confidence in Spain's fiscal management, said Hans Martens, chief executive of the European Policy Center think tank, dismissing any suggestion Spain would be the next Greece.

Spain's debt-to-GDP ratio is still below the EU limit of 60 percent and much smaller than Greece's, and it is expected to have little or no trouble in the short term servicing its debt.

But Spain's budget deficit rose to 11.4 percent of GDP last year and economists question whether Madrid can come close to the government's forecast of 1.5 percent growth from 2010-2013.

Spain has to avoid being a second Greece. Politicians in Spain have to understand they need to take tough measures, Darvas said. They must adopt to the new circumstances.

The government has launched a 50-billion-euro austerity program but, facing an election in 2012, has wavered over increasing the retirement age from 65 to 67 and said it will not give in to demands to make it cheaper to hire and fire workers.

Economists say EU officials are right to be wary and prepare new safety mechanisms, such as the European monetary fund idea.

Unless we see more focus on growth and a less obsessive focus on stability, I think there will be trouble. You are not going to have stability without growth, said Simon Tilford of the London-based Center for European Reform think tank.

It will be hard to get Spanish people to acquiesce to austerity measures. It's going to be a tough sell.

(Editing by Mark Trevelyan)