Europe's banks were told to cut dividends and bonuses to help them find 106 billion euros ($146 billion) to shore up their capital, and agreed to halve the value of their Greek government debt.

After tense talks that ran to the early hours of Thursday, the agreement by private sector investors to take a 103-billion euro hit on their Greek bonds marked a breakthrough for EU leaders trying to halt a eurozone debt crisis from spreading.

Details on how the plan will work have yet to be agreed, however.

Hours earlier, banks in Spain, Italy, France, Portugal, Greece and elsewhere were told they needed to recapitalize to be able to better withstand eurozone sovereign bond losses and an economic downturn.

The amount needed was in line with expectations, though Spanish banks need more than many analysts' forecast, at 26 billion euros.

Bank shares were expected to open higher at relief that the deadlock had been broken.

It's short on detail but it's progress, said Simon Maughan, head of trading for Europe at MF Global.

There's a fairly defined timeline to deal with this. The banks have to raise all of the money by the end of June, so they've got to get on with it.

Seventy banks were tested, but the European Banking Authority (EBA) did not break down how much each lender needs, although some announced details.

Spain's BBVA said it needs 7.1 billion euros.

France's BNP Paribas requires 2.1 billion euros, Societe Generale needs 3.3 billion and BPCE, the mutual that owns Natixis , is in need of 3.4 billion.

Other major banks expected to need to bolster capital include Spain's Santander , Italy's UniCredit and Germany's Deutsche Bank .

Capital raising by the banks is also expected to be modest. Of the sum needed, 30 billion euros is already being provided to Greek banks under an aid plan, and other capital is earmarked for banks in Portugal and for Dexia.

Cutting dividends this year and next could save banks billions of euros, and asset sales and debt liability management plans will provide further cash. Some deleveraging -- as long as it is not excessive -- will lift capital ratios further.

That could see banks needing to raise less than 30 billion euros from investors. With European bank shares trading at an average 0.6 times book value, any capital raising would be painfully dilutive for investors.

($1 = 0.724 Euros)

(Reporting by Steve Slater; Editing by David Hulmes)