A day after U.S. stocks had their worst day in four years, the major stock indices closed lower after a surge in the morning.

On Monday, the Dow Jones industrial average closed lower by more than 588 points lower at the closing bell, down about 3.6 percent. This morning, the Dow jumped about 2.2 percent after the opening bell today to 16,231, while the S&P 500 was up 2.2 percent to 1,935. The Nasdaq increased about 2.7 percent to 4,645 just minutes after the start of trading in New York.

By this afternoon, the indices had lost most of their gains. The Dow closed the day lower, about 1.3 percent, while the S&P 500 closed 1.4 percent lower. The Nasdaq closed lower 0.4 percent.

After a global sell-off in the last three days, investors were concerned about a slowdown in the world's second-biggest economy, China, and how that could affect trade and U.S. businesses.

"The markets are caught between a domestic U.S. economy that is still struggling to gain momentum, but remains firmly in positive territory, and a global economy that appears to be poised for ongoing weakness," Lindsey Piegza, Stifel chief economist, said.

Specialist Michael O'Mara works on the floor, Aug. 25, 2015, of the New York Stock Exchange.  (Richard Drew/AP Photo) Specialist Michael O'Mara works on the floor, Aug. 25, 2015, of the New York Stock Exchange.

The Shanghai Composite Index was down 7.6 percent earlier today, leading to its biggest four-day fall since 1996. Shares there continued their downfall despite a move today by The People’s Bank of China to cut lending rates with the hope that banks lend more money. The Chinese central bank cut interest rates for the fifth time since November to 4.6 percent from 4.85 percent and it lowered banks' reserve requirement.

Mark Zandi, chief economist with Moody's Analytics, said the move by the Chinese government has given a lift to global stock markets, while U.S. economic data released this morning, including new home sales, showed strengthening.

"Most importantly, consumer confidence looks solid, particularly consumers' assessment of the job market," Zandi said, referring to the index of consumer confidence in August released today. "While the stock market is swinging up and down, the economy continues to steadily power forward."

Get real-time updates as this story unfolds. To start, just "star" this story in ABC News' phone app. Download ABC News for iPhone here or ABC News for Android here.