BERLIN — Germany’s center-left opposition won a wafer-thin victory over Chancellor Angela Merkel’s coalition in a major state election Sunday, dealing a setback as she seeks a third term at the helm of Europe’s biggest economy later this year.

The opposition Social Democrats and Greens won a single-seat majority in the state legislature in Lower Saxony, ousting the coalition of Merkel’s conservative Christian Democratic Union and the pro-market Free Democrats that has run the northwestern region for 10 years. The same parties form the national government.

The 58-year-old Merkel will seek another four-year term in a national parliamentary election expected in September. She and her party are riding high in national polls, but the opposition hoped the Lower Saxony vote would show she is vulnerable.

The outcome could boost what so far has been a sputtering campaign by Merkel’s Social Democratic challenger, Peer Steinbrueck.

“This evening gives us real tailwind for the national election,” said Katrin Goering-Eckardt, a leader of Steinbrueck’s allies, the Greens. “We can and will manage to replace the (center-right) coalition.”

However, the close outcome also underscores the possibility of a messy result in September, with no clear winner.