ROME—Italy’s wobbly government coalition breathed a sigh of relief after the center-left Democratic Party won a crucial regional electio n on Sunday, seeing off a strong challenge by Matteo Salvini’s far-right League.

With most of the votes counted, Stefano Bonaccini, the Democratic incumbent president of Emilia-Romagna, was re-elected with 51% of the vote. The League’s candidate, Lucia Borgonzoni, won 44% of the vote.

The contest in the affluent northern region of Emilia-Romagna became the most closely watched Italian regional election in years as Mr. Salvini campaigned there relentlessly to oust the incumbent Democrats.

Emilia-Romagna has been a stronghold of Italy’s left throughout the post-World War II era. But as in much of Europe, mainstream left-of-center parties are struggling to hold on to their traditional working-class voters, opening up new opportunities for nationalist, anti-immigration politicians such as Mr. Salvini.

Despite the Democrats’ win in their own historic heartland, the foundations on which Italy’s coalition government between the Democrats and the antiestablishment 5 Star Movement rests remain fragile. Democrats are struggling to increase their popularity and win back disillusioned voters who in recent years have turned to other parties including the League.