ZAGREB, Croatia - A conservative populist become Croatia's first female president Sunday after beating the center-left incumbent in a runoff election amid deep discontent over economic woes in the European Union's newest member.

The state electoral commission said that after about 97 percent of the vote counted, Kolinda Grabar-Kitarovic won 50.54 of the vote Sunday, while President Ivo Josipovic had 49.46 percent.

The result meant that Grabar-Kitarovic won by a slight margin of about 21,000 votes.

Get Breaking News Delivered to Your Inbox

Josipovic, a law professor and composer of classical music, conceded defeat, saying Grabar-Kitarovic won in a "democratic competition."

The vote was seen as a major test for Croatia's center-left government, which is facing parliamentary elections later this year under a cloud of criticism over its handling of the economic crisis. The conservative triumph could shift Croatia back to right-wing nationalism, jeopardizing relations with its neighbors, including bitter Balkan wartime rival Serbia.

The vote was always expected to be close. In the first round two weeks ago, Josipovic won 38.5 percent of the vote, just edging Grabar-Kitarovic with 37.2 percent. The runoff was called because neither candidate captured more than 50 percent needed to win outright.

The presidency in Croatia is a largely ceremonial position, but the vote was considered an important test for the main political parties before the parliamentary elections expected in the second half of the year. The victory for Grabar-Kitarovic - giving her a five-year term - greatly boosts the chances of her center-right Croatian Democratic Union to win back power.

A voter casts her ballot at a polling station in Zagreb, Croatia, Sunday, Jan. 11, 2015. AP / Darko Bandic

Grabar-Kitarovic, a former foreign minister, ambassador to Washington and an ex-assistant to the NATO secretary general, said earlier Sunday she felt "very confident" of a victory because "people will vote for a change."

She has said that Josipovic did nothing to stop Croatia's economic downturn, including a 20-percent unemployment rate - one of the highest in the EU.

Josipovic has said the president's duties don't include the government's economic policies and has proposed constitutional changes that would decentralize the country and give more power to Croatia's regional authorities.

Grabar-Kitarovic also criticized Josipovic for allegedly being too soft toward Serbs, who in the 1990s fought a war against Croatia's independence from the former Yugoslavia. She said Serbia's EU membership bid must be conditioned by Croatia.

"Serbia is our neighborly and friendly country," Josipovic said after he cast his ballot. "But it has to meet the same conditions which we had during our bid for the European Union."

Autocratic nationalist President Franjo Tudjman and his conservative HDZ party ruled Croatia until his death in 1999, marking the start of democratization that put Croatia, with the population of 4.2 million, on track to EU membership, which was accomplished in 2013.

Croatia declared independence in 1991.