U.S. stocks finished broadly higher Tuesday as investors grew more optimistic about the prospects for a resolution to the costly trade dispute between the U.S. and China.

Technology, financial and health care stocks powered much of the rally, which gave the benchmark S&P 500 index its biggest gain this month and a three-day winning streak. The wave of buying also drove a 372-point gain for the Dow Jones Industrial Average, ending the average's four-day run of losses.

President Donald Trump said he's not inclined to extend the deadline, but he might let it "slide for a little while" if talks go well. Earlier, the White House had called March 2 a "hard deadline."

Both nations are trying to reach a deal before March 1. That's when additional tariffs will kick in, escalating the conflict and further hurting companies and consumers with higher prices on materials and products.

U.S. negotiators began mid-level talks with their Chinese counterparts in Beijing on Monday. U.S. Trade Representative Robert Lighthizer and Treasury Secretary Steven Mnuchin are scheduled to step in Thursday for two more days of negotiations.

The world's two biggest economies are locked in a dispute over U.S. charges that China steals U.S. technology and forces American companies to turn over trade secrets in exchange for access to the Chinese markets. The tactics are alleged to be part of China's push to challenge U.S. technological dominance.

"Things are going well with China," Trump said. "China wants to make a deal very badly. I want it to be a real deal — a real deal with China."

Trump again said he and Chinese President Xi Jinping would have to meet to work out a final deal.

"At some point, I expect to meet with President Xi, who I have a lot of respect for and like a lot, and make the parts of the deal that the group is unable to make," he said. "That's the way deals happen."

The U.S. has slapped tariffs on $250 billion in Chinese imports and has threatened to raise tariffs 80 percent of those March 2. China has punched back with tariffs on $110 billion in U.S. products. The dispute has rattled financial markets and darkened the outlook for the world economy.

"Any deal would help alleviate some of the uncertainty," said Karyn Cavanaugh, senior markets strategist at Voya Investment Management. "The GDP hasn't been dinged that much from the trade tariffs, it's really been the uncertainty. It's spilling over into business plans and that's a hurdle for growth."

Stocks got an early boost Tuesday after lawmakers in Washington reached a tentative deal to avoid another partial government shutdown. The agreement on border security involves far less money for a wall than the White House wanted, and it's not clear whether Trump will support the deal.

Still, the move alleviated some uncertainty for the market as the U.S. and China continue trade negotiationsy.

Fears of a global slowdown still linger. Europe and China have both reported slower growth. Those concerns have dimmed the outlook for corporate earnings growth this year.

We're improving out commenting experience.

We’ve temporarily removed comments from articles while we work on a new and better commenting experience. In the meantime, subscribers are encouraged to join the conversation at our Post and Courier Subscribers group on Facebook.