Prime Minister George Papandreou’s new cabinet was approved in parliament by 155 votes to 143, with two abstentions.
MPs will now be asked to approve 28bn euros (£25bn) of cuts, tax rises, fiscal reforms and privatisation plans.
Eurozone ministers say the legislation must be passed to receive a 12bn-euro loan Greece needs to pay its debts.
Earlier, thousands of people gathered outside the parliament building in Athens to protest against both the austerity measures and politicians in general. Many chanted: “Thieves! Thieves!”
“I believe we should go bankrupt and get it over with. These measures are slowly killing us,” Efi Koloverou, a 22-year-old student, told the Reuters news agency. “We want competent people to take over.”
Mr Papandreou reshuffled his cabinet and replaced his finance minister last week after weeks of demonstrations against his handling of the crisis.
‘Moment of truth’
The confidence vote took place early on Wednesday after a heated debate on Tuesday that saw sections of the opposition briefly walk out.
Despite the threat of a revolt within the governing Panhellenic Socialist Movement (Pasok), MPs voted strictly along party lines.
The prime minister earlier acknowledged the austerity measures were tough but said the last thing Greece needed now was an election.
“At this time of pain I want to send a message to all Greeks,” he said. “Yes, the course is difficult but there is light at the end of the tunnel.
“We all have to agree that we will put an end to deficits. We want to make a leaner, healthier state, because otherwise our country cannot take the burden.”
The assertions were dismissed by some opposition MPs during the debate.
“This is not a programme to salvage the economy, it’s a programme for pillage before bankruptcy,” Alexis Tsipras of the Left Coalition said.
Mr Papandreou must now persuade parliament to approve a five-year package of 28bn euros of tax increases and spending cuts by 28 June.
It will then have to push through laws implementing the reforms in time for an extraordinary meeting of eurozone finance ministers on 3 July.
On Sunday, the eurozone ministers said they would withhold the payment of the latest tranche of the European Union and International Monetary Fund’s 110-bn euro bail-out package until the laws were in place.
Greece needs the loan to be able to keep up with payments to creditors of its 340bn euros of debts, which amounts to 30,000 euros per person.
European Commission President Manuel Barroso warned that Greece faced a “moment of truth” and needed to show it was “genuinely committed to the ambitious package of further fiscal measures and privatisations” needed to avoid a sovereign default.
The eurozone ministers also agreed on Sunday to put together a second bailout package worth 120bn euros to fund Greece into late 2014.
The new aid package, to be outlined by early July, will include loans from other eurozone countries. It will also feature a voluntary contribution from private investors, who will be invited to buy up new Greek bonds as old ones mature. Officials said this money had to be freely given, or it would be seen as technical default on Greece’s debt repayments.
The objective of Mr Papandreou, the EU and IMF is to reduce the Greek government’s borrowing needs and make its debt sustainable.
But the cuts will make it even harder to generate the economic growth needed to boost tax revenue, our correspondent says.
That is why many in the financial markets expect that Greece will at some stage fail to repay its debts in full and on time, even if Mr Papandreou manages to maintain the repayments for the immediate future, he adds.
If Greece were to default on its debt – worth 150% of its annual GDP output – it would have to leave the 17-member eurozone and trigger massive losses for European banks that hold Greek debt, including the European Central Bank.