After their worst year in close to a decade US stocks started the new year with a more than 1% decline on Wednesday before inching their way back into the black as Donald Trump blamed a “glitch” for last year’s losses.

Markets wobbled between gains and losses all day on Wednesday as weak data in Asia and Europe confirmed fears of a global economic slowdown while the US government shutdown dragged on.

In the White House Trump told reporters that equities should recover when the US completes trade deals with countries like China.

“Our country is doing better by far than any other country in the world. We’re the talk of the world,” Trump said. “We had a little glitch in the stock market last month, but we’re still up about 30% from the time I got elected.

“It’s going to go up once we settle trade issues and a couple of other things happen,” Trump said. “It’s got a long way to go.”

All 11 major S&P sectors were lower in early trading but by noon markets appeared to be recovering. US investors have witnessed wild daily swings at the end of 2018 and the first day of trading in the new year looked little different.

China’s factory activity contracted for the first time in 19 months in December, hit by the Sino-US trade war, with the weakness spilling over to other Asian economies. Eurozone manufacturing activity dropped for the fifth month and barely avoided contraction. That news led to sell offs across Asia earlier in the day.

The grim readings come ahead of the closely watched US manufacturing survey on Thursday, payrolls data on Friday and the US earnings season later this month, which is expected to show corporate profit shrank in the October-December quarter.

“Increasing evidence of China’s economy weakening further has sent chills throughout global markets. This fear has been a depressing factor for the markets,” Peter Cardillo, chief market economist at Spartan Capital Securities, said in a client note.

The Dow Jones Industrial Average ended the day up 0.08%, ; the S&P 500 was up 0.13%, and the technology led Nasdaq Composite was up 0.46%.

The tech index – which suffered last year’s biggest losses – had earlier slipped 1.15%, with Microsoft Corp and Apple down nearly 2% and Amazon and Netflix down over 1%.

Market volatility is also being stoked by developments in Washington where the US Congress is set to reconvene with no signs of a workable plan to end a 12-day-old partial shutdown and Trump not budging on his demand for $5bn to fund a border wall.