By Lefteris Papadimas and Harry Papachristou
ATHENS (Reuters) - Greece's government voted by a razor thin margin on Thursday to approve an austerity package needed to unlock vital aid and avert bankruptcy, despite an internal rift and violent protests at the gates of parliament.
Lawmakers approved the spending cuts, tax hikes and measures making it easier to hire and fire workers after nearly 100,000 Greeks waving flags and chanting "Fight! They're drinking our blood!" descended on Syntagma Square in central Athens.
Despite the abstention of their junior ruling partner the Democratic Left, Prime Minister Antonis Samaras's New Democracy Party and its Socialist PASOK allies passed the 500-odd page bill shortly after midnight.
They mustered 153 of parliament's 300 seats, with New Democracy and PASOK expelling seven deputies from their ranks for not backing the measures.
Earlier in the evening, clashes erupted when a handful of protesters tried to break through a barricade to enter the assembly. Riot police responded with teargas, stun grenades and, for the first time in an anti-austerity protest here, water cannon.
There was also chaos inside the assembly, where parliamentary workers briefly stopped the session by walking out when they discovered their salaries would be cut.
The bill covering the bulk of 13.5 billion euros' ($17.2 billion) worth of belt-tightening measures is a precursor to the 2013 budget law, which the government is expected to push through on Sunday.
If it does, it is expected to unlock a 31.5 billion euro aid tranche from the International Monetary Fund and European Union that Greece needs to shore up its banks and pay off loans.
"We must now pass the budget and right after that work for the recovery of the economy," Samaras told Reuters after the vote.
The euro rose briefly to around $1.2780 from $1.2765 before the vote.
"We're seeing little bit of a bounce in the euro because the threat of a Greek exit from the euro zone is dissipating now that the Greeks have made the difficult decision to move forward with painful austerity measures," said Kathy Lien, managing director of BK Asset Management in New York.
The vote came on the second day of a two-day national strike called by the country's two biggest unions, which halted public transport and shut schools, banks and government offices. Garbage piled up on the streets.
Backed by the leftist opposition, unions said the measures would hit the poor and spare the wealthy, while deepening a five-year recession that has wiped out a fifth of the country's output and driven unemployment to a record 25 percent.
Anger has also been growing at the relaxed approach consecutive governments have taken towards catching tax cheats, with many saying officials have dragged their feet on investigations to protect a wealthy elite.
"You live in constant fear and uncertainty. You never know what's waiting for you around the corner," said Panos Goutsis, 58, who works in a small corner shop in Athens.
"How many times will they tell us these are the last measures? We're sick of hearing it."
Outside parliament, loud booms rang out through the evening as hooded protesters wearing gas masks hurled molotov cocktails and rocks at police. Billowing smoke and small fires dotted the square and streets next to parliament.
At least 35 people were detained. There were no reports of serious injuries, police said.
"These measures are killing us little by little, and lawmakers in there don't give a damn," said Maria Aliferopoulou, a 52-year-old mother of two living on 1,000 euros a month.
"They are rich, they have everything, and we have nothing and are fighting for crumbs, for survival."
BALL IN EU COURT
Calm returned as protesters emptied the square during a steady downpour. The anti-austerity rally appeared to be the largest in Athens since summer last year.
Analysts said that if the government pushed through the budget on Sunday as expected, euro zone finance ministers could agree at a meeting in Brussels on Monday to let Greece push back its fiscal targets by two years to 2016 and ease austerity's grip on growth.
That, in turn, will allow the European Central Bank to also take measures to give Athens some slack, and the debate can then turn to ways of easing Greece's debt load, which is expected to peak at more than 190 percent of gross domestic product in 2014.
Eurasia Group analyst Mujtaba Rahman said Samaras's government had shown stronger will than any of its predecessors in pushing through the belt-tightening.
But a key question remains over whether the Mediterranean state, having failed to implement numerous austerity plans in the past, would be able to overcome intransigence in the country's institutions and put Wednesday's package into force.
"There is political will. The question is whether the bureaucracy has the capacity to implement reforms," Rahman said.
"Whether it can work is still an open question."
(Additional reporting by Karolina Tagaris, Renee Maltezou and Dina Kyriakidou; Writing by Michael Winfrey and Deepa Babington; Editing by Will Waterman)