An alliance of left-wing Portuguese lawmakers on Tuesday brought down the government of Prime Minister Pedro Passos Coelho, turning the country’s politics on its head just weeks after inconclusive elections and offering up a strong new challenge to the austerity policies that have divided Europe.

Mr. Passos Coelho, a center-right leader, was ousted after lawmakers voted to reject his new government’s program, 123 to 107.

The prime minister had been held up as a model proponent of the belt-tightening prescriptions pushed by European Union officials in Brussels, international creditors and countries like Germany.

Ahead of the vote, the country’s finance minister had warned members of Parliament that a turnaround in economic policy could have dire consequences at a time when Portugal’s debt continues to be rated as junk by three of the major credit rating agencies.