PRAGUE — After an election campaign centered on questions of civility in politics and the Czech Republic’s place in Europe, voters decided on Saturday to stick with President Milos Zeman and his often-caustic brand of populism that has stoked resentment toward Muslim immigrants and ruptured the country’s relationship with its allies to the west.

His opponent, Jiri Drahos, a political novice whose views were not well known, sought to present himself as an antidote to what he characterized as Mr. Zeman’s bitter and divisive leadership. In recent years, Mr. Zeman, 73, has strengthened the country’s ties with Russia and has courted China.

Mr. Drahos, 68, offered a firm commitment not just to the country’s membership in the European Union, but also to the bloc’s values. In rejecting his vision, the country was poised to continue in the same euroskeptic direction as its neighbors Hungary, Poland and Slovakia.

With more than 99 percent of the votes counted, the state-owned Czech News Agency declared Mr. Zeman the winner with 51.4 percent of the votes (or 2.8 million), compared with Mr. Drahos’s 48.6 percent (2.7 million).