BERLIN — Germany’s Social Democrats (SPD) scored a much-needed victory in a regional election Sunday, following a crushing defeat in last month’s national election.

Projections on Sunday evening showed the SPD winning 37.3 percent of the votes in Lower Saxony, Germany’s fourth most populous state, which was almost 4 percentage points ahead of their key rivals, Chancellor Angela Merkel’s Christian Democrats (CDU) at 33.4 percent, according to Infratest dimap.

It's the first time since 1998 that the SPD has managed to become the strongest party in the swing state, and the surprise victory could help the party's embattled chief Martin Schulz secure his standing after he led the party to its worst national election result in postwar history last month.

"For the first time ... in 19 years, we will be the largest group in the state parliament," said the SPD’s state premier Stephan Weil Sunday evening, "[Merkel's] Christian Democrats are the clear losers of this election."

The Greens won around 8.9 percent of the votes, ahead of the liberal Free Democrats (FDP) at 7.4 percent, and the far-right Alternative for Germany (AfD) at 6.2 percent. The far-left Die Linke, at 4.6 percent, failed to clear the 5 percent hurdle necessary to enter the parliament.

"The party stuck together" — SPD chief Martin Schulz

Lagging behind in polls in Lower Saxony two months ago, the Social Democrats saw a surge in support as election day neared, running neck-and-neck, with the CDU just ahead of the vote.

For the last four years, Lower Saxony — a diverse swing state with an electorate of about 6.1 million people — has been governed by the SPD with the Greens.

In July, the ruling coalition was forced to call a snap election after one Green party lawmaker left her party, shattering a wafer-thin, one-seat majority.

Taking place three weeks after Germany’s general election, the outcome of Sunday’s regional vote is widely considered an indicator of the national mood.

In September, Merkel scored the fourth victory of her career but suffered heavy losses to the far right.

As the chancellor is about to start coalition talks to form her next national government in Berlin, Sunday's outcome in Lower Saxony strikes a blow to Merkel and her center-right CDU.

On Wednesday, Merkel will meet with the Greens and the FDP for the first time to talk over a so-called Jamaica coalition.

The election outcome in Lower Saxony — which suggests that the state will most likely be governed by an SPD-led government — will complicate those negotiations, as the state government's influence in the upper house of parliament will make it more difficult for Merkel and her future government to push through legislation during the next four years.

At the same time, the surprise victory will likely help stabilize the standing of its struggling party chief Schulz. Some in the party cautioned Schulz ahead of Sunday's vote that he would not survive another loss after the three regional election defeats this spring before the general election disaster in September.

"On September 24, we experienced a bitter defeat, but the party did something that makes me proud and grateful," Schulz said Sunday evening, visibly relieved. "The party stuck together."