The passage of the bill was a decisive step for the country to get the next batch of bailout loans from international creditors and was met with a huge sigh of relief in markets and by Greece's partners in the eurozone. A Greek default could potentially trigger a banking crisis, particularly in Europe, and turmoil in global markets.
Another bill has to be passed on Thursday (local time) for the government to secure the money.
The bill to cut spending and raise taxes by €28 billion over five years, and raise €50 billion in privatizations over the same period of time, has provoked widespread outrage, coming after a year of deep cuts that have seen public sector salaries and pensions cut and unemployment rise to above 16 percent.
While deputies voted, stun grenades echoed across the square outside the Parliament building and acrid clouds of tear gas hung in the streets. The violence continued sporadically after the vote and smoke was billowing from beneath the Finance Ministry.
Authorities and emergency services said 31 police and 15 protesters were injured and transferred to hospitals, while 30 people were detained, and 11 arrested.
Volunteer doctors said they had treated about 40 people, most with facial injuries and breathing problems, at a makeshift treatment site at a metro station next to parliament. Protesters were seen leaving the site with bandaged heads.
Head medical volunteer Flegas Stagos said more seriously wounded protesters were put onto the metro with volunteers so they could receive treatment away from the tear gas.
The European Union and International Monetary Fund have demanded both bills pass before it releases a €12 billion installment of the country's €110 billion bailout fund. Without it, Greece was facing defaulting on its debts by the middle of next month.
Even with the instalment, Greece is still in financial trouble and has been in talks with its international creditors for a second bailout, which Prime Minister George Papandreou has said will be roughly the same size as the first.
"We must avoid the country's collapse with every effort," Papandreou said before the vote. "Outside, many are protesting. Some are truly suffering, others are losing they privileges. It is their democratic right. But they and no-one else must never suffer the consequences and for their families of a collapse. We must do everything so that there is no freeze in payments."
The Greek vote was greeted positively in Europe's capitals, which have been fretting about the impact of a potential Greek default both on their banking systems and on the future of the euro currency itself.
"That's really good news," German Chancellor Angela Merkel said when told of the outcome of the vote on her way out of an economic forum in Berlin. Germany is Greece's biggest creditor.
EU leaders hailed the vote as an act of "national responsibility" and urged Greek lawmakers to follow up with another positive vote on Thursday.
In a joint statement, the heads of the EU commission and council, Jose Manuel Barroso and Herman Van Rompuy, said Greece had taken "a vital step back - from the very grave scenario of default" and urged a second positive vote on Thursday to allow the next batch of money to be disbursed.
"It would also allow for work to proceed rapidly on a second package of financial assistance, enabling the country to move forward and restoring hope to the Greek people," they said.
Equally, relief was the main response in markets. Soon after the vote, the euro was trading at a fairly elevated level around the $US1.44 mark while stock markets around the world were posting big gains. In Greece, the main Athens stock market closed up 0.5 percent at 1264, while the country's borrowing costs eased some 80 basis points from a morning high, with the yield on 10-year bonds settling at the still high 16.55 percent.
"The fact that the Greek parliament has passed the government's medium-term fiscal plan clearly reduces the chances of a near-term disaster," said Ben May, European economist at Capital Economics.
Even if Greece gets more bailout funds, many economists think the country will end up defaulting on its debts in some form or another. Implementing the measures is not going to be made any easier if the widespread opposition continues.
"This is bad, the country will be sold for a piece of bread," said Dimitris Kostopoulos, a 48-year-old insurer. "There were many other more appropriate alternatives to this. Parliament has once again betrayed us."
In the run-up to the vote, violence engulfed the square outside for the second day, while services across the country ground to a halt in the last day of a 48-hour general strike. Riot police fired volleys of tear gas at swarms of young men hurling rocks and other debris as well as setting fire to trash containers.
Protesters threw flares and orange and green smoke bombs, and a few sprayed fire extinguishers at police, who picked up rocks and tossed them back. Heavy clouds of tear gas wafted over the chaotic scene.
The unpopular package of spending cuts and tax hikes passed by 155 votes to 138, with five opposition deputies voted "present" - a ballot which backs neither side.
A sole deputy from the governing socialists, Panayotis Kouroublis, dissented over government plans to sell a further stake in Greece's state electricity company and was quickly expelled from the parliamentary group by Papandreou.
In a dramatic vote, socialist deputy Alexandros Athanassiadis, who had previously vowed to vote against the bill, overturned his decision at the last minute and backed the package, saying he had been swayed by the prime minister's comments in parliament.
A conservative deputy broke ranks with her party's line to also vote in favor, bolstering the government's majority of five seats in the 300-member parliament.