Stocks rose on Tuesday after a report said the U.S. and China are seeking talks to defuse an escalating trade conflict between the two countries. Equities also posted their biggest monthly gains since the start of the year.
The Dow Jones Industrial Average jumped 108.36 points to close at 25,415.19, with 3M, Caterpillar and Pfizer as the best-performing stocks in the index. The gained 0.5 percent to 2,816.29 as industrials rose more than 2 percent. The Nasdaq Composite advanced 0.6 percent to 7,671.79.
Bloomberg News reported that the world's largest economies are trying to restart talks in order to avoid a full-blown trade war. The report, which cites two people familiar with the situation, said Treasury Secretary Steven Mnuchin and Chinese Vice Premier Liu He are talking privately about the matter. Mnuchin told CNBC last week "there continue to be some quiet conversations" regarding China.
"It's just an agreement to have talks. We don't know where the talks go or whether they will be fruitful. They seem to be resuming high-level talks. We'll have to see what comes of it," said Peter Boockvar, chief investment officer at Bleakley Advisory Group.
Shares of big exporters Boeing and Caterpillar jumped 1.5 percent and 2.9 percent, respectively, on the report. Deere's stock also gained nearly 5 percent.
Tuesday was the last trading day of July, and the major averages posted solid monthly gains. The Dow and S&P 500 rose 4.7 percent and 3.6 percent, respectively, their biggest monthly gains since January. The Dow gained 5.8 percent in January, while the S&P 500 rose 5.6 percent that month. The Nasdaq, meanwhile, climbed more than 2 percent in July and notched its fourth straight monthly gain.
Equities have gotten a boost this month from strong corporate earnings and positive economic data.
The Commerce Department said on Friday the U.S. economy grew by 4.1 percent in the second quarter, notching its fastest growth rate since the third quarter of 2014. The economy got a boost from strong consumer and business spending as well as a surge in exports.
About 60 percent of the S&P 500 has released its latest quarterly results, with 82 percent of those companies posting better-than-expected earnings, according to Thomson Reuters I/B/E/S.
"Do you remember all the pundits who warned 1Q 2018 earnings were at their peak? Well, the 2Q 2018 numbers for these 299 S&P 500 companies that have reported are better than how they reported last quarter in terms of year-over-year sales and earnings growth. There are also more companies beating estimates this quarter as well," Nick Raich, CEO of The Earnings Scout, wrote in a note.
The corporate earnings season continued on Tuesday with Dow components Procter & Gamble and Pfizer reporting better-than-expected earnings. Shares of Procter were up 0.9 percent, while Pfizer's stock gained 3.5 percent. Apple, another Dow component, is scheduled to report Tuesday after the close.
But stocks have been under pressure recently amid a steep sell-off in tech. Tech has lost 5.4 percent over the past three sessions after mixed results from some of the largest companies in the sector. Facebook reported weaker-than-expected revenue last week and disappointing global daily active users, a key metric for the company. Twitter, meanwhile, posted fewer-than-expected monthly users for the previous quarter.
"Facebook is the poster child for the recent Tech stock decline," said Nicholas Colas, co-founder of DataTrek Research, in a note. "While its competitive advantage remains robust, expected returns on capital are lower than before last week's earnings release (higher costs to fix the platform) and growth rates for capital deployed are also suspect."
These results have led some investors to lose faith in the so-called FANG trade, which is responsible for the lion's share of the S&P 500's gains this year. They have also led to the tech-heavy Nasdaq falling at least 1 percent in three consecutive sessions. The good news for investors is the Nasdaq tends to bounce back sharply from such losses.
Since the financial crisis, the Nasdaq has posted three straight losses of 1 percent or more on five occasions, according to data from Kensho. Following those drops, the Nasdaq has risen more than 5 percent over the next month, the data shows.
— CNBC's Patti Domm contributed to this report.