Technology and health care companies led U.S. stocks higher, giving the benchmark S&P 500 its fourth straight weekly gain and more in Friday’s Stock Market Update.

The broad rally came as investors grew hopeful that the latest round of talks between the U.S. and China will lead to a resolution of the costly trade war that’s unsettled markets and threatened the global economy.

High-level discussions between the Trump administration and Chinese negotiators were slated to continue through the weekend. President Donald Trump told reporters Friday afternoon that it was “more likely” that the talks will result in a deal.

Uncertainty over trade has contributed to a dimmer outlook for corporate earnings growth this year and added to concerns about the global economy, which is showing some signs of slowing.

“Investors are clearly optimistic that a compromise on trade talks will be coming sooner rather than later and those expectations appear to be reflected in the market rebound we see today,” said Saira Malik, head of global equities at Nuveen.

The S&P 500 index rose 17.79 points, or 0.6 percent, to 2,792.67. The Dow Jones Industrial Average gained 181.18 points, or 0.7 percent, to 26,031.81. The Nasdaq composite climbed 67.84 points, or 0.9 percent, to 7,527.54. The Russell 2000 index of smaller companies picked up 14.51 points, or 0.9 percent, to 1,590.06.

Major European indexes finished higher.

The world’s two biggest economies are locked in a trade conflict spurred by U.S. contentions that China uses predatory tactics to overtake U.S. technological dominance, including pressuring American companies to hand over trade secrets and in some cases stealing them outright.

The Trump administration has warned it will increase its import taxes on $200 billion in Chinese goods from 10 percent to 25 percent if the two sides haven’t reached a resolution by March 2. But the White House has signaled a willingness to extend the deadline if negotiators are making progress.

President Donald Trump, fielding questions from reporters in the Oval Office late Friday afternoon, reiterated that he would “certainly consider” delaying that deadline if talks are going well. The negotiations were slated to continue through the weekend.

Asked about the prospects for a deal, Trump said: “It’s probably more likely that a deal does happen.”

Wall Street has been encouraged by the signals that Chinese and U.S. officials have sent since trade talks resumed early last week. That helped lift the market, along with better-than-expected company earnings for the fourth quarter of 2018 and the Federal Reserve’s decision to take a pause on interest rate hikes.

“But the bigger picture is that with the market having such a nice rally year-to-date, we actually think we’re in for a period of consolidation,” Malik said. “Until you can see sustainable global economic growth, we think it’s going to be tough for the market to really move a lot higher from here.”

Traders also weighed a mix of company earnings reports Friday.

Wayfair jumped 27.9 percent after the online home furnishings retailer reported quarterly results that topped Wall Street’s forecasts.

Universal Display climbed 23 percent after the LED technology company posted better-than-expected quarterly earnings and its guidance surpassed investor expectations.

Zillow Group climbed 24.7 percent a day after the online real estate information company issued quarterly earnings that topped analysts’ expectations. The company also said co-founder Rich Barton has been named chief executive. Barton previously held the job from 2005 until 2010.

Kraft Heinz plunged 27.5 percent after the packaged foods company posted a stunning $12.6 billion fourth-quarter loss as it slashed the value of its Oscar Mayer and Kraft brands by $15.4 billion. The company also disclosed it was being investigated by federal securities regulators and cut its dividend.

Dropbox slid 8.4 percent after the online data storage company issued a disappointing outlook. plunged 57.8 percent after the online shipping and postage company ended its exclusive partnership with the U.S. Postal Service and gave a weak forecast.

Benchmark U.S. crude rose 0.5 percent to settle at $57.26 a barrel in New York. Brent crude, used to price international oils, gained 0.1 percent to close at $67.12 a barrel in London.

Bond prices rose. The yield on the 10-year Treasury note fell to 2.65 percent from 2.67 percent late Thursday.

The dollar rose to 110.71 yen from 110.68 yen on Thursday. The euro strengthened to $1.1337 from $1.1336.

Gold rose 0.4 percent to $1,332.80 an ounce. Silver gained 0.7 percent to $15.91 an ounce. Copper climbed 1.9 percent to $2.95 a pound.

In other energy futures trading, wholesale gasoline fell 0.2 percent to $1.61 a gallon. Heating oil declined 0.3 percent to $2.03 a gallon. Natural gas gained 0.7 percent to $2.72 per 1,000 cubic feet.