Germany's centre-left opposition has edged Chancellor Angela Merkel's conservatives from power in a regional vote in Lower Saxony.
The result revives its flagging hopes of defeating Ms Merkel in September's national election.
The Social Democrats (SPD) and Greens won by a single seat after a close race for power in Germany's fourth most populous state.
Ms Merkel's Christian Democrats (CDU) lost ground but its Free Democrat (FDP) allies defied forecasts that it would be ejected from the state assembly in Hanover.
"A one-vote majority can be very stable," said Stephan Weil, Hanover mayor and SPD state premier candidate after a six-hour wait for results that were too close to call.
The outcome will be a setback for Ms Merkel, but the 58-year-old Chancellor still enjoys high personal popularity for her leadership role in the euro crisis where she defends Germany's economic interests.
She might also cite the success of the FDP as a good omen for September polls she hopes will return her centre-right coalition.
The SPD had been dreading the results, with its own candidate for chancellor, Peer Steinbrueck, struggling to rally support after a series of gaffes.
Mr Steinbrueck acknowledged "shared responsibility" for a patchy campaign in Lower Saxony, a major agricultural and industrial centre, but said the result proved that the SPD was clearly still in the race for September.
"This means a change of government and of power are possible this year," he said.
SPD chairman Sigmar Gabriel - a former state premier of Lower Saxony himself - said with a smile: "If we get a result like this when we mess up, we can do anything."
The SPD and Greens won 46.3% against 45.9% for the CDU and its Free Democrat partners - who easily cleared the 5% hurdle to enter the assembly with a vote of 9.9% - twice what had been expected.
The CDU remained the biggest party in the swing state but suffered its 13th local election setback in a row - and lost its fifth state government to the SPD since 2009.