BERLIN — Angela Merkel won a fourth term as chancellor in elections on Sunday, placing her in the front ranks of Germany’s postwar leaders, even as her victory was dimmed by the entry of a far-right party into Parliament for the first time in more than 60 years, according to preliminary results.

The far-right party, Alternative for Germany, or AfD, got some 13 percent of the vote — nearly three times the 4.7 percent it received in 2013 — a significant showing of voter anger over immigration and inequality as support for the two main parties sagged from four years ago.

Ms. Merkel and her center-right Christian Democrats won, the center held, but it was weakened. The results made clear that far-right populism — and anxieties over security and national identity — were far from dead in Europe.

They also showed that Germany’s mainstream parties were not immune to the same troubles that have afflicted mainstream parties across the Continent, from Italy to France to Britain.