ISTANBUL--The Turkish economy contracted in the first quarter of 2019, a challenge for President Recep Tayyip Erdogan's ruling party ahead of looming re-run of the Istanbul mayoral elections amid mounting political tensions with the U.S.

Turkey's gross domestic product fell 2.6% in the first quarter, after shrinking 3% in the fourth quarter, according to data released by TUIK, the national statistics agency.

The breakdown of the data showed that consumer spending was down 4.7% on the year in the first three months of the year, while government spending rose 7.2% in the same period.

Economists had forecast a 2.5% contraction in the first quarter, according to a survey by The Wall Street Journal.

The Organisation for Economic Co-operation and Development expects the Turkish economy to contract by 2.6% this year.

The lira crisis last summer weighed on consumption and investments. The Turkish currency lost 30% of its value against the dollar in 2018, and has plunged a further 13% since the start of this year.

The lira came under renewed pressure after the national election board earlier this month canceled results of the Istanbul mayoral race, which the ruling party of Mr. Erdogan lost, and ordered the vote be reheld. This sparked outrage in opposition ranks and fueled investor concerns of increased economic volatility.

Tension has also been mounting with the U.S. over Ankara's push to purchase Russian S-400 missile defense systems, a move that could lead to sanctions from Washington.

Mr. Erdogan and President Trump had a phone call on Wednesday and the Turkish president reiterated to Mr. Trump an offer for the formation of a joint working group on Turkey's plan to procure the S-400.

The Turkish currency was trading 0.2% lower against the dollar at 5.88 after the figures were released.