Greek lawmakers agreed in principle on an overhaul of the country's ailing pension system in a preliminary vote on Wednesday, in a sign that a reform key to restoring the country's ailing finances is likely to pass.

The reform is one of the most controversial undertaken by the Socialist government struggling with a debt crisis shaking the euro zone. Thousands will take to the streets in a 24-hour strike on Thursday to protest against it.

A key element of a 110 billion euro bailout agreement with the EU and the IMF, the bill reforms a social security system experts expect to collapse in 15 years if no changes are made.

The reform cuts benefits, curbs widespread early retirement, increases the number of contribution years from 35-37 to 40 and raises women's retirement age from 60 to match men at 65.

For the bill to become law it must be approved in a second vote expected on Thursday, on the day of a general 24-hour strike organized by the country's main public and private sector unions against the pension reform bill.

With this great reform, we safeguard pensioners and the next generation. We are putting Greece back on the right fiscal track and on the path of growth, Labour Minister Andreas Loverdos told lawmakers on Wednesday.

A number of lawmakers from the ruling socialist PASOK party had criticized the bill and the vote in parliament is an important test of the government's ability to get its own ranks on board and push reform through.

Some 159 lawmakers voted for the bill in principle on Wednesday -- all PASOK lawmakers and two independent MPs -- while 137 opposition lawmakers voted against the reform, in a sign that the reform will likely pass in the final vote.

Greece aims to raise the effective average retirement age to 63.5 years by 2015 from 61.4 now. The reform increases the minimum early retirement age to 60 by 2011, including workers in so-called heavy and arduous professions, who draw full benefits despite retiring earlier.

The bureaucratic pension system's costs would double to 24 percent of GDP by mid-century, the highest in the euro zone, if left unchanged, according to EU forecasts.

Prime Minister George Papandreou told lawmakers before the vote that without this reform the country's economy would fall apart under the weight of increasing pension costs.

But he promised young Greeks would get a pension when they reach retirement age and pledged to improve pensions once the crisis-hit economy recovers, saying that a flat 800 euro bonus for all but the highest pensions could be increased.

Analysts see the pension reform as a major test in tackling a sector which epitomizes many of the root causes of Greece's financial crisis, along with tax evasion, red tape, selective privileges and delayed reforms.

To sway reluctant lawmakers, the government has made some amendments to the draft bill, including clauses saying that the government will guarantee decent pensions and may increase benefits if the country's economic situation improves.

Opinion polls show many Greeks oppose the reform and believe it will not work.

(Reporting by Angeliki Koutantou; Writing by Ingrid Melander; Editing by Jon Boyle)