Stocks closed higher on Thursday on renewed hope that a resolution to a trade dispute with China could be on the horizon. Investors also cheered strong quarterly results from Walmart and Cisco Systems.

The Dow Jones Industrial Average rose 396.32 points to 25,558.73 — its biggest one-day jump since April 10, when it surged 429 points — led by gains in Walmart, Cisco Systems, Boeing and Caterpillar. The gained 0.8 percent to 2,840.69 as consumer staples and telecom outperformed. The Nasdaq Composite advanced 0.4 percent to 7,806.52.

The S&P 500 also closed 1.1 percent below its record high set on Jan. 26 while the Nasdaq finished the session 1.6 percent off its all-time high. The Dow, meanwhile, is about 4 percent removed from an all-time high.

National Economic Council Director Larry Kudlow confirmed to CNBC's "Squawk Box" earlier reports saying China and the U.S. will hold a fresh round of trade talks later in August, giving investors hope that the two world's largest economies can solve an ongoing trade spat.

"This move in the market, I think, is almost entirely related to China," said Randy Frederick, vice president of trading and derivatives at the Schwab Center for Financial Research. "I know it's not resolved but the fact that they are talking is enough for the market to go up."

The U.S. and China have been engaged in a trade spat recently as the U.S. slaps tariffs on Chinese imported goods. China, meanwhile, has retaliated with tariffs of its own on U.S. goods. Investors worry that an escalation in trade fears could lead to a global economic slowdown and lower corporate profits.

"My guess has been that tariffs have been a tactic of the Trump administration" to bring people to the table and negotiate on trade, said Maris Ogg, president of Tower Bridge Advisors. "I think getting this resolved before the midterm has become an imperative to remove that cloud of uncertainty from the market." Ogg added that once the trade dispute is resolved, the market will go back to focusing on strong earnings.

Shares of Boeing and Caterpillar, two bellwethers for global trade, rose 4.3 percent and 3.2 percent, respectively. Both companies get a large share of their revenue from outside the U.S., so their stocks are highly sensitive to trade-related news. Boeing recorded its biggest one-day gain since January while Caterpillar logged in its best day in more than a month.

To be sure, a report from Reuters characterized the talks between the U.S. and China as "lower level."