(Bloomberg) -- The world economy took a body blow in the third quarter with Japan and Germany both contracting, although both are set to rebound.

One-off factors were largely to blame -- weather in Japan and cars in Germany. But the data from the third- and fourth-largest economies are a setback when the outlook for global growth is already fraying amid jittery financial markets and mounting trade wars.

China provided some sense of stability as infrastructure investment and industrial production picked up, while weak retail sales underscored the slowdown underway in the No. 2 economy.

Markets are starting to fret with stocks and oil prices both sliding sharply. The MSCI index of global stocks dropped more than 7 percent in October, its worst month since 2012. Oil is witnessing a record losing streak and OPEC warns demand for crude is falling faster than expected.

“The timing is bad,” said Junko Nishioka, chief Japan economist at Sumitomo Mitsui Banking Corp. and a former Bank of Japan official. “Contractions in two major economies are likely to make investors and companies more cautious about the outlook for the global economy.”

Both the Japanese and German economies are forecast to rebound this quarter after shrinking an annualized 1.2 percent and 0.2 percent on a quarterly basis respectively.

But there’s no ignoring that underlying momentum in the export-heavy nations is being undermined by the U.S.’s antagonistic tone on trade.

Reports that President Donald Trump will hold off for now on imposing levies on imported Japanese cars and auto parts keeps one of the biggest threats to Japan’s economy at bay for the time being. Germany is benefiting from a truce between the EU and the U.S., though European Commission President Jean-Claude Juncker signaled this week that this might only last until year-end.

Each economy also stands to lose out from weaker Chinese demand. Nishioka at Sumitomo Mitsui sees only a limited pickup in Japan this quarter, while investors surveyed by ZEW have a relatively subdued take on the expected bounce in Germany.

As for China, its authorities say they’ll act to arrest any damage to the economy, with the People’s Bank of China saying last week it will “preemptively adjust and fine-tune policies according to the changing conditions.”

Industrial production rose in China more than expected in October and there was also a stronger reading from fixed-asset investments, signaling that government stimulus aimed at spurring infrastructure investment is finally passing through.

Germany is also expecting improvement after a soft patch, though not enough for Commerzbank economist Joerg Kraemer to maintain his 2018 outlook. He cut his forecast for growth to 1.5 percent from 1.8 percent.

“We do not expect the Chinese economy to collapse,” he said. “For this reason, the leading indicators in Germany should stabilize soon. The upswing is slowing down, but will continue in the coming year.”

To contact the reporters on this story: Fergal O'Brien in Zurich at fobrien@bloomberg.net;Toru Fujioka in Tokyo at tfujioka1@bloomberg.net

To contact the editors responsible for this story: Craig Stirling at cstirling1@bloomberg.net, Kevin Costelloe

©2018 Bloomberg L.P.