(AP) -- Technology companies led a broad rally in U.S. stocks Wednesday that gave the market its third consecutive gain and nudged the Nasdaq composite to an all-time high.
The major stock indexes jumped in the last half-hour of trading amid reports that a meeting between President Donald Trump and a European Union trade delegation had yielded an agreement to work on averting a budding dispute between the two trading partners.
Health care and industrial stocks also posted solid gains. Phone companies and other high-dividend, safe-play stocks lagged the broader market. Homebuilders slumped on government data showing sales of new U.S. homes fell in June.
Prior to the developments out of Washington, stocks had held on to modest gains for most of the day as investors drew encouragement from the latest batch of quarterly earnings results.
"Tariffs haven't had an enormous impact on earnings, particularly in the manufacturing sector," said Jeramey Lynch, global investment specialist at J.P. Morgan Private Bank. "We haven't seen that so far. Earnings have still been strong because the potential impacts so far of tariffs are being more than offset by what we see as a very favorable macroeconomic backdrop."
The S&P 500 index notched its best day in more than a month, climbing 25.67 points, or 0.9 percent, to 2,846.07. The Dow Jones Industrial Average surged 172.16 points, or 0.7 percent, to 25,414.10. The Nasdaq added 91.47 points, or 1.2 percent, to 7,932.24. The Russell 2000 index of smaller-company stocks followed up its worst day in a month with a gain of 5.01 points, or 0.3 percent, to 1,685.20.
The S&P 500, the market's benchmark index, is on track for its fourth weekly gain in a row.
Investors have been focused this week on company earnings, which have mostly topped Wall Street's expectations. At the same time, traders are still wary of global trade tensions, which have ratcheted up in recent weeks as the U.S. and some of its trading partners have imposed tariffs on certain products and threatened more.
That's why news that the U.S. and the EU are working to mend their frayed trade relationship injected a wave of hopeful buying into the market.
Trump, speaking from the Rose Garden with European Commission President Jean-Claude Juncker, said late Wednesday afternoon that the EU had agreed to buy "a lot of soybeans" and increase its imports of liquefied natural gas from the U.S. Juncker, meanwhile, said the U.S. and EU had agreed to hold off on further tariffs as part of trade talks aimed at averting a crippling trade dispute involving the lucrative automobile market.
"We remind investors only that the devil remains in the details," Terry Haines, macro research analyst at Evercore ISI, wrote in a research note.
The latest wave of corporate report cards also had traders in a buying mood Wednesday, with the technology sector accounting for most of the market's gains. Corning vaulted 11.3 percent to $33.21.
HCA Healthcare jumped 9.2 percent to $118.13 after the hospital operator turned in quarterly results that were better than analysts were expecting.
Coca-Cola rose 1.8 percent to $46.09 after the company served up quarterly earnings and revenue that topped analysts' forecasts. The company noted that its diet sodas are selling better after undergoing some image changes.
Not all companies reported favorable results.
General Motors slumped 4.6 percent to $37.65 after the automaker cut its outlook for the year, mostly due to tariffs on imported steel and aluminum. The diminished expectations overshadowed GM's strong second-quarter results.
Boeing reported quarterly results that exceeded Wall Street's expectations, but also cut its revenue projections for its defense business. Shares in the aerospace giant fell 0.7 percent to $355.92.
Tupperware plunged 16.4 percent to $34.09 after the container maker reported weaker-than-expected sales and lowered its annual forecasts.
Of the roughly 23.6 percent of the companies in the S&P 500 that had issued quarterly results as of early Wednesday, some 71 percent reported earnings and revenue that beat analysts' forecasts, according to S&P Global Market Intelligence.
It was a rough day for homebuilders. Those stocks slumped after the Commerce Department said sales of new U.S. homes fell 5.3 percent last month. The decline occured even though buyers continue to outnumber sellers in a still-tight housing market. Beazer Homes USA tumbled 7.7 percent to $13.28.
Benchmark U.S. crude added 78 cents, or 1.1 percent, to settle at $69.30 per barrel in New York. Brent crude, used to price international oils, added 49 cents to close at $73.93 per barrel in London.
Bond prices fell. The yield on the 10-year Treasury rose to 2.96 percent from 2.95 percent late Tuesday.
The dollar fell to 110.83 yen from 111.22 yen on Tuesday. The euro strengthened to $1.1699 from $1.1683.
Gold gained $6.30 to $1,231.80 an ounce. Silver added 7 cents to $15.59 an ounce. Copper rose 1 cent to $2.82 a pound.
In other energy futures trading, heating oil rose 2 cents to $2.15 a gallon. Wholesale gasoline added 3 cents to $2.12 a gallon. Natural gas gained 4 cents to $2.78 per 1,000 cubic feet.
Major stock indexes in Europe finished lower. Germany's DAX lost 0.9 percent and France's CAC 40 slipped 0.1 percent. London's FTSE 100 slid 0.7 percent.
In Asia, Tokyo's Nikkei 225 gained 0.5 percent and Hong Kong's Hang Seng rose 0.9 percent. Seoul's Kospi fell 0.3 percent. Sydney's S&P-ASX 200 declined 0.3 percent.