Stocks rose on Wednesday as investors grew hopeful that Chinese and U.S. trade authorities would reach an agreement before a deadline in early March.

The Dow Jones Industrial Average climbed 117.51 points to 25,543.27 as Walgreens Boots Alliance and 3M outperformed. Wednesday also marked the Dow's second straight day of gains. The gained 0.3 percent to 2,753.03, led by gains in the industrials and energy sectors. The Nasdaq Composite advanced 0.08 percent to 7,420.38.

Energy stocks got a boost from higher oil prices. The S&P 500 energy sector gained more than 1 percent, led by Newfield Exploration, Apache and Devon Energy, as West Texas Intermediate futures climbed 1.5 percent to $53.90.

President Donald Trump suggested Tuesday that he might be open to postponing the current deadline of early March so that both sides can reach a deal.

"Markets always assumed the March 1 trade deadline was flexible, but this just confirmed it," Tom Essaye, founder of The Sevens Report, wrote in a note. "Bottom line, the fundamentals are roughly balanced right now as there is optimism that a trade deal will get done."

"Looking ahead, a trade deal could reduce concerns about growth and allow the 2019 rally to continue," Essaye added.