Amazon rose 1.3 percent and provided the biggest boost to the S&P and the Nasdaq.
"The economy is looking good, numbers look good, and companies are making money".
Investor focus returned to quarterly earnings, which will start in full swing on Friday, with the big US lenders JPMorgan and Wells Fargo.More news: Durbin: Trump said 'shithole' repeatedly, comments were 'vile, racist'
"I don't know how much of that is priced in right now", said Stephen Massocca, senior vice president at Wedbush Securities in San Francisco.
Earnings for S&P 500 companies are expected to increase by 11.8 percent on an average, with the biggest contribution from the energy sector, according to Thomson Reuters I/B/E/S.
Delta Air Lines rose about 2 percent after reporting upbeat quarterly profit as well as forecast, helped by higher business fares in a busy holiday season.More news: 'Animaniacs' Reboot Lands Two-Season Straight-to-Series Order at Hulu
At the closing bell, the Dow Jones Industrial Average stood at 25,574.73, up 0.8 percent.
Industrial companies that advanced included Dow members Caterpillar and Boeing which won 2.0 and 2.4 percent and Cummins, which advanced 1.9 percent. It closed at $1,305.20.
Consumer discretionary (+1.3%) was the top-performing group, with Lowe's (+5.4%) setting the pace after reports that investor D.E. Shaw has build an active stake in the company. But analysts said the gains also reflected the market's underlying bullishness after a sweeping USA tax cut was enacted in December. The S&P 500 gained 2.31 points, or 0.083467 percent, to 2,769.87.More news: Ex-hostage Boyle charged with sex assault, forcible confinement
Advancing issues outnumbered declining ones on the NYSE by a 1.17-to-1 ratio; on Nasdaq, a 1.54-to-1 ratio favored advancers.