The S&P 500 rose 14.31 points, or 0.8 percent, to 1,782, its 34th record close this year.
The Dow Jones industrial average gained 70.96 points, or 0.5 percent, to 15,821.63, also a record. The Nasdaq composite rose 45.66 points, or 1.2 percent, to 3,965.58, well below its record close of 5,048.52 reached in March 2000.
Macy's jumped $4.35 to $50.68. Its earnings climbed 22 percent for the quarter ended. Nov. 2. The department store chain, which rose the most in the S&P 500 index, was the first major retailer to report earnings for the quarter.
U.S. stocks started the day lower as investors considered when the Federal Reserve might start reducing its economic stimulus.
The Fed is buying $85 billion of bonds a month to keep interest rates low and support the economy. That has helped drive a rally in stocks this year. Surprisingly strong reports on economic growth and hiring last week have led investors to speculate that the Fed may pare back its stimulus sooner than expected.
"We're in a pause as everyone waits for more data," said Kate Warne, a strategist at investment adviser Edward Jones.
Investors will closely follow Thursday's confirmation hearing for Janet Yellen, who has been nominated to succeed Fed Chairman Ben Bernanke, for clues about when the Fed may begin to pull back its economic stimulus.
Chegg, an online textbook rental company, flopped on its first day of trading, slumping $2.82, or 22.6 percent, to $9.68. Another market debut did much better: Extended Stay America, a hotel operator, jumped $3.87, or 19 percent, to $23.87.
In government bond trading, the yield on the 10-year Treasury note fell to 2.73 percent from 2.77 percent Tuesday.
About 90 percent of companies in the S&P 500 have now reported third-quarter results, and earnings are projected to rise by 5.6 percent in the July-to-September period, according to S&P Capital IQ. That's better than the 4.9 percent growth recorded in the second quarter and better than the 2.4 percent growth in same period a year earlier.
The strong trend in earnings should help the stock market rebound from any weakness caused by concerns that the Fed is set to cut its stimulus, said Dan Morris, Global Investment Strategist at TIAA-CREF, an asset management company.
"What really matters are earnings for corporations," Morris said. "If people focus on that, it's all pretty good."
In commodities trading, the price of oil rebounded after a slump on Tuesday. Oil rose 84 cents, or 0.9 percent, to $93.88 a barrel. Gold fell $2.80, or 0.2 percent, to $1,268.40 an ounce.
Among other stocks making big moves:
— Potbelly rose $2.52, or 9.3 percent, to $29.58, after its third-quarter earnings came in ahead of market expectations. It was the restaurant operator's first quarter as a publicly traded company.
— Perry Ellis fell $4.47, or 23 percent, to $15 after lowering its revenue forecast, citing fewer shipments and lower sales through its direct retail channel. The clothing company also cut its full-year forecast.