China's huge economy is cooling just as trade tensions with the United States are heating up.

The world's second-biggest economy grew by 6.7% in the second quarter of the year.

That was slightly lower than the previous quarter and is China's slowest rate of quarterly growth in almost two years.

The official figures released Monday suggest China is still on track to meet the government's 2018 target of about 6.5%, although the intensifying trade clash with the United States means the rate of growth is likely to continue to slow this year.

Analysts have previously forecast that trade tensions could shave up to 0.5 percentage points off Chinese growth this year, depending on the intensity of tariffs.

Earlier this month, the Trump administration and China imposed tariffs of 25% on $34 billion of each other's exports. US tariffs on an additional $16 billion of Chinese goods are coming soon.

The US government also said last week it was readying new tariffs on Chinese goods worth an additional $200 billion, releasing a list including fruit and vegetables, handbags and baseball gloves.

The impact of tariffs on China's economy is likely to be felt in the second half of this year.

Related: China's economy shows signs of slowing: A trade war won't help

Tensions surrounding trade have also taken their toll on China's stock market, which has been one of the world's worst performers this year.

The prospect of greater tariffs in future is "already dampening business confidence and delaying investment," said Louis Kuijs, head of Asia economics at research firm Oxford Economics.

The Chinese government's push to rein in the huge levels of debt in the country, which have risen sharply since the global financial crisis a decade ago, have also contributed to the slowdown.

President Xi Jinping and other top officials have talked about reducing risks in China's financial system, which is often referred to as "deleveraging." They have also tried to crack down on China's huge shadow banking sector in which murky forms of lending are kept off banks' official balance sheets.

Julian Evans-Pritchard, senior China economist at research firm Capital Economics, pointed out that production at Chinese factories, retail spending and infrastructure spending all disappointed in the most recent quarter.

"Headline official indicators are now in broad agreement that the economy is losing momentum," he said.

The Chinese economy performed strongly last year, growing 6.9%, according to government figures.

Correction: An earlier version of this article gave the incorrect year for China's growth target of 6.5%.