Technology companies led stocks solidly higher Tuesday, giving the market its second straight gain.
Consumer-services companies, retailers and health care stocks accounted for a big slice of the broad rally. Banks declined, and oil prices recovered from an early slide.
Strong company earnings and outlooks, as well as some encouraging economic data, helped put investors in a buying mood.
"Even though we're early in the earnings season, the fact that we continue to see good earnings and earnings growth come out is really what's driving the market," said Nana Adae, global investment specialist at J.P. Morgan Private Bank. "Earnings growth ties to fundamentals and fundamentals are key."
The S&P 500 index rose 28.55 points, or 1.1 percent, to 2,706.39. The Dow Jones industrial average gained 213.59 points, or 0.9 percent, to 24,786.63. The latest gain nudged the blue chip average into positive territory for the year.
The Nasdaq composite climbed 124.81 points, or 1.7 percent, to 7,281.10. The Russell 2000 index of smaller-company stocks picked up 16.77 points, or 1.1 percent, to 1,579.80.
While the market has been preoccupied lately with concern over geopolitical and trade tensions, Wall Street has something else to focus on over the next few weeks: company earnings.
Financial analysts are forecasting the strongest growth in seven years for S&P 500 companies, because of a resurgent global economy, and because of last year's corporate tax cut.
"There's no doubt that corporate tax reform is a tail wind for earnings, but organic growth is really what is driving a lot of these earnings," Adae said.