FRANKFURT — In ominous signs of the damage being done by the trade war between China and the United States, data released on Wednesday indicated that the German economy was hurtling toward recession and that growth at Chinese factories was slowing at a pace not seen in nearly two decades.

The numbers are among the most tangible consequences of President Trump’s tariffs on global trade for China as well as Germany, which sets the tone for Europe. Mr. Trump is succeeding in inflicting pain on countries he accuses of unfair trade practices, but economists warn that the pain is likely to boomerang onto the United States.

Germany’s economy shrank 0.1 percent from April through June, and it has been treading water for the past year, the government’s official statistics agency said. Deutsche Bank analysts predicted that the economy would continue to shrink in the current quarter, meeting the technical definition of a recession.

In China, factory output in July fell to its slowest pace in 17 years, according to government data. Although the Chinese economy posted trade figures that were stronger than expected last week, the industrial output figure was another sign that China’s overall growth rate continues to slow under the weight of the trade war and the country’s debt problems.