BERLIN — A far-right party made significant gains Sunday in two closely watched state elections, snapping at the heels of parties in Chancellor Angela Merkel’s governing coalition and highlighting a growing political divide between the country’s East and West, initial returns showed.

Ms. Merkel’s party and one of her coalition partners won enough support to beat back the Alternative for Germany, the far-right group known by its German initials, AfD. That robbed it of what would have been a powerful symbolic victory: the chance to emerge as the strongest force in one of the country’s 16 states.

But both governing parties suffered heavy losses to the AfD in two states that were once in the Communist East of Germany, which could further weaken faith in her government at a time when the German economy is starting to slow.

The results highlight a deep division between what was once East Germany and the rest of the country, which the AfD both tapped into and exacerbated during the campaign.