It came after a night of rain, tear gas and clashes. But after four months of tortuous negotiations and a rancorous parliamentary debate, the Greek parliament finally announced late on Wednesday night that it had passed the most draconian package yet of austerity measures needed to keep Europe's weakest economy afloat.

Following heady scenes inside and outside the 300-seat house, 153 MPs supported the €13.5bn (£10.8bn) package in a vote that will be remembered as perhaps the most electrifying in the history of the three-year Greek debt crisis.

Approval of the spending cuts, tax rises and labour reforms was given with a weakened majority – seven rebels voted against the measures – but on trade markets around the world there were signs of relief. Mandarins in Brussels said the ballot would pave the way to the release of €31.5bn in EU and IMF sponsored rescue funds – desperately needed to keep bankruptcy at bay.

"Greece today has taken a big, decisive and optimistic step. A step towards recovery," said prime minister Antonis Samaras after the cliffhanger vote. "I am very pleased," he told reporters before emphasising that the "next step" was passage of the 2013 budget in a vote on Sunday.

With Greece's future within the eurozone resting on the result, the conservative leader had implored wavering lawmakers to back the legislation as 100,000 protesters braved sporadic downpours to scream "Fight! They're drinking our blood" and other anti-austerity slogans.

"The issue is to keep the country in the euro," Samaras told the assembled deputies shortly after violence broke out when a tiny minority tore down a barricade in an attempt to storm the parliament.

"These are the very last painful measures," said the leader, whose fragile coalition had faced its greatest test with the vote. "If further fiscal adjustment is needed it will come from clamping down on tax evasion and cutting public expenditure."

As street battles raged, authorities used water cannon to disperse demonstrators throwing petrol bombs at police while loud booms and the piercing blasts of stun grenades rang out.

The small Democratic Left party, a junior partner in the tripartite alliance, abstained from supporting the bill.

Dissent in the socialist Pasok party was such that six of its 33 MPS also refused to put their names to the deficit-reducing measures, with defectors arguing they would drive the country into even deeper recession. An MP in Samaras's New Democracy party also abstained. The seven deputies were expelled from their respective parties within minutes of the roll-call.

With the Greek economy on course to contract for a sixth straight year and more than a quarter of the country's labour force out of work, Alexis Tsipras, who heads the radical left main opposition Syriza party, lambasted the government for "leading Greek people to catastrophe and chaos".

He said the "absurd" measures would worsen the country's economic death spiral. "Very soon you will be back in this parliament again listening to the programme policies of a new government," he railed, denouncing Samaras for promoting policies he opposed in opposition.On the streets, Greeks reacted with a mixture of fury and malaise with many openly questioning the prime minister's assertion that the measures would be the last to be imposed on a nation that has seen wages and pensions decreased five times in the past three years. "Until now Greeks have been asleep. We haven't really reacted at all," said Kostas Mitas, a 48-year-old tradesman whose views were on display in a T-shirt that proclaimed "fuck off Troika" in an allusion to the country's international creditors. "But Greeks are unpredictable and I'm afraid that they might wake up suddenly. For the moment these measures are just hypothetical but when they start to be felt we could see a lot of violence."

The vote came on the second day of a 48-hour general strike, with unionists vowing yet more industrial action in the days and months ahead. "These policies are clearly not working. All they have done is impoverish Greeks and this country and instead of going down our debt is simply going up," said Ilias Iliopoulos at the civil servants' union, Adedy. "People are going hungry, more than two million are unemployed. This government isn't going to last long, of that you can be sure," he added. "These measures may have become law but they won't be able to enforce them."

But analysts begged to differ. Fears of Greece slipping over the edge were so strong that the coalition would survive, they said.

"Everyone knows that elections would be a catastrophe and nobody wants them, not even the main opposition," said professor Dimitris Keridis, who teaches political science at Athens' Panteion University. "Even if there is a lot of dissatisfaction within the government, this simple fact is Samaras's biggest asset."