A parliamentary vote to elect a president in Greece failed on Monday, unsettling stock markets in Europe’s most precarious countries and setting off worries that a new Greek political upheaval could reignite a long-simmering debt crisis.

The vote means Greece will hold national elections in late January—possibly opening the door to Syriza, a left-wing coalition that leads most polls over the ruling New Democracy party and is a potent opponent of the austerity-led policies ordered by Greece’s international rescuers and carried...