The gains were enough to mark more record highs for several of the indexes, though not the Dow Jones Industrial Average.
Trading was lighter than usual, and stocks flipped between small gains and small losses for most of the day.
Outside of technology and retail, most other stocks finished lower. Energy companies dipped along with oil prices, and an increase in bond yields dented high-dividend stocks like utilities and phone companies, which investors tend to buy when they are seeking income.
Canada’s foreign minister arrived in Washington to resume trade talks Tuesday, a day after stocks rose on news that the Trump administration had reached a preliminary deal with Mexico to replace the North American Free Trade Agreement.
“If we do get a new agreement in North America with lower overall tariffs or trade restrictions, long-term that’s a pretty positive result,” said Jim Paulsen, chief investment strategist for the Leuthold Group.
The S&P 500 index rose 0.78 points to 2,897.52. The Dow Jones Industrial Average rose 14.38 points, or 0.1 percent, to 26,064.02. The Nasdaq composite gained 12.14 points, or 0.2 percent, to 8,030.04.
The Russell 2000 index of smaller-company stocks inched up 0.02 point to 1,724.42.
The S&P 500, Nasdaq and Russell all closed at record highs. More stocks fell than rose on the New York Stock Exchange.
Shoe retailer DSW surged 20.2 percent to $32.70 after reporting second-quarter results that were far stronger than analysts expected. Sales surpassed Wall Street forecasts, and the company raised its estimates for the rest of the year.
Tiffany did the same and its stock added 1 percent to $131.07. Like many other retailers, their stocks had slumped in recent years due to growing competition from online retailers and sinking sales in stores.
Retail stocks have climbed recently as they improved their online businesses. DSW has risen 53 percent in 2018 and Tiffany has rallied 26 percent. When the companies fall short of expectations, however, their stocks have plunged.
That happened to Macy’s, Gap and J.C. Penney in the second quarter. And on Tuesday Best Buy fell 5 percent to $77.57 after issuing a disappointing forecast for the current quarter.
Apple rose 0.8 percent to $219.70 as technology companies, the most valuable part of the S&P 500, did better than the rest of the market. Chipmaker Xilinx rose 2.3 percent to $76.99 and Qualcomm gained 3.6 percent to $69.78.
The dollar continued to slip as investors reacted to signs the U.S. was making progress in resolving some of its trade disputes. The Trump administration has announced numerous tariffs this year, and those tariffs have made the dollar stronger.
The dollar rose to 111.21 yen from 111.10 yen. The euro rose to $1.1696 from $1.1680.
While some experts think stocks could rally if the U.S. and its partners make progress on new trade deals, Paulsen said there might not be a big market reaction because it’s not clear how much trade tensions have actually harmed stocks this spring and summer.
Bond prices fell. The yield on the 10-year Treasury note rose to 2.88 percent from 2.85 percent.
High dividend stocks including utilities, phone companies and household goods makers lagged the rest of the market, as they did on Monday.
Campbell Soup fell 2.1 percent to $39.83 after the New York Post reported that the company is wrapping up a strategic review and is unlikely to try to sell itself. Campbell announced the review in May along with the departure of CEO Denise Morrison.
The Post reported in July that activist investor Daniel Loeb is pushing the company to sell, and if it decides not to do that, he could launch a bid for control of the company.
News and financial information company Thomson Reuters jumped 3.2 percent to $44.66 after it announced an offer to buy back up to $9 billion in company stock. It offered to pay between $42 and $47 a share.
Akcea Therapeutics plunged 25.3 percent to $24.73 and Ionis Pharmaceuticals dropped 15.9 percent to $45.17 after the Food and Drug Administration didn’t approve their drug Waylivra. It’s designed to treat a rare genetic condition that can causes fatal pancreatitis.
Benchmark U.S. crude dipped 0.5 percent to $68.53 a barrel in New York while Brent crude, used to price international oils, fell 0.3 percent to $76 a barrel in London.
Wholesale gasoline slid 0.5 percent to $2.08 a gallon. Heating oil dropped 0.2 percent to $2.21 a gallon. Natural gas fell 0.8 percent to $2.85 per 1,000 cubic feet.
Gold fell 0.1 percent to $1,214.40 an ounce. Silver dipped 0.6 percent to $14.77 an ounce. Copper gained 1 percent to $2.74 a pound.
France’s CAC 40 rose 0.1 percent while Germany’s DAX lost 0.1 percent. Britain’s FTSE 100 jumped 0.5 percent.
Japan’s benchmark Nikkei 225 rose 0.1 percent. South Korea’s Kospi edged up 0.2 percent and Hong Kong’s Hang Seng added 0.2 percent.