Romania's Social Democrat-led government has survived a parliamentary vote of no confidence after the country witnessed its largest protests in decades over a corruption decree.

Ioana Bran, the parliamentary secretary, said on Wednesday that 161 MPs voted in support of the motion, short of the 232 votes needed for it to pass.

The Social Democrats and their allies control nearly two thirds of the seats in parliament after winning a December election.

They abstained from Wednesday's vote.

Romania president's hometown divided over crisis

"The necessary majority has not been met, according to the constitution, for the vote to pass," Bran said.

At least 5,000 protesters gathered outside government headquarters late on Wednesday to demand the cabinet's resignation, despite a snowstorm, subzero temperatures and power blackouts. "We exist, we resist," they chanted.

Catalin Predoiu, an opposition deputy, said of the motion: "This is a warning signal that we managed to gather the votes of the whole opposition and it also shows that whenever the new government derails we will gather and sanction it."

For over a week, hundreds of thousands of people have protested against the government after it passed a decree to decriminalise some official corruption.

Critics decried the move as a major setback to the country's anti-corruption drive.

Bowing to pressure, the government scrapped the ordinance on Sunday as some 500,000 people protested across the country.

The rallies were the largest protests in Romania since the fall of communist rule in 1989.

'Ugly face of politics'

The motion will now be debated by the parliament.

Klaus Iohannis, Romania's president, said the fight to contain corruption shows the "ugly face of politics".

He told the Associated Press news agency that the massive street protests were successful in stopping the decree that would have eased up on public officials who abuse their power while in office.

He said he was pleased that protesters cared about the future of Romania and made their feelings known.

READ MORE: Romanian government under pressure as 500,000 protest

"I was surprised by the size of the crowd," he said.

"Having over 200,000 people in Piata Victoriei [Victory Square] is something extraordinary."

The Constitutional Court rejected challenges on procedural grounds brought against the rescinded decree by Iohannis and by the top magistrates' council.

The court said it would reconvene on Thursday to consider a separate challenge brought by Romania's ombudsman against the content of the decree.