A rally in tech stocks led the Nasdaq Composite and S&P 500 to record highs, with Amazon, Alphabet and Apple leading the gains. Investor sentiment was also boosted by the resumption of U.S.-Canada trade talks.

The Nasdaq gained 1 percent to close at 8,109.69. The rose 0.6 percent to 2,914.04, closing above 2,900 for the first time. The S&P 500 tech sector rose 1 percent. The Dow Jones Industrial Average climbed 60.55 points to 26,124.57 as Apple rose 1.5 percent to an all-time high.

Amazon shares rose 3.4 percent to a record after Morgan Stanley raised their price target on the stock, predicting a $1.2 trillion valuation for the company. Analyst Brian Nowak said Amazon's advertising, subscription and cloud businesses "will drive higher profitability and continued upward estimate revisions." Amazon's stock closed at $1,998.10.

Shares of Google-parent Alphabet gained 1.5 percent after Morgan Stanley raised its price target on the stock, making it the highest on Wall Street. The analysts cited Waymo, the company's self-driving auto unit, as the big upside catalyst for the stock. Alphabet shares closed at $1,264.65.

Canadian Foreign Minister Chrystia Freeland rejoined NAFTA talks after the U.S. and Mexico announced they had struck a bilateral trade deal. Freeland told reporters that Mexico's "difficult" concessions to the States earlier this week would help lead the way for productive discussions between the three countries this week.

On Tuesday, U.S. Treasury Secretary Steven Mnuchin told CNBC that he was optimistic on striking a deal with Canada, but added that the White House was ready to go forward with Mexico alone, if it isn't executed. The U.S. is hoping an agreement with Canada will be made before the week ends.