The S&P 500 climbed closer to a record high, lifted by energy stocks and a solid quarterly report from Johnson & Johnson.
After dipping into negative territory and then recovering, the S&P 500 ended less than two percent short of last May's record high close, with investors laser-focused on a growing flow of first-quarter earnings scorecards.
Following two months of steady gains, the S&P 500 is trading at about 17.8 times expected earnings, the highest level since 2004, according to Thomson Reuters Datastream.
Chevron and other energy stocks got a lift from a rally in crude after a strike by oil workers in Kuwait dented the OPEC country's output.
A recent rebound in oil and signs that the US economy is slowly improving have helped stocks rally from a steep selloff earlier this year that had pushed the S&P 500 down as much as 10.5 percent.
Earnings of S&P 500 companies are seen falling 7.6 percent on average and revenues are seen dipping 1.3 percent, with the energy sector weighing heavily, according to Thomson Reuters.
"Investors are very focused on revenue," said Chuck Self, Chief Investment Officer of iSectors in Appleton, Wisconsin.
"After all the cost cutting over the past five years, now we need to start seeing revenue growth."
The Dow Jones industrial average rose 0.27 percent to 18,053.6 points and the S&P 500 gained 0.31 percent to 2,100.8.
The Nasdaq Composite dropped 0.4 percent to 4,940.33, hobbled by a 23.16-percent slide in Illumina after its preliminary results fell short of expectations.
Also hitting tech sentiment, IBM fell 5.59 percent after it reported its worst quarterly revenue in 14 years, and was the biggest drag on the Dow and S&P 500.
Netflix shares fell 12.97 percent after the video streaming service's subscriber forecast missed estimates.
After the bell, Yahoo posted its first-quarter results and shares moved up one per cent. Intel shares fell 2.4 percent after it announced plans to reduce its global workforce by 11 percent.
During the session, eight of the 10 major S&P sectors rose, led by a 2.13-percent rise in the materials sector.
Energy was up 1.88 percent.
Johnson & Johnson rose 1.57 percent after it reported marginal growth in quarterly sales. The stock was the biggest positive influence on the S&P 500.
Goldman Sachs shares added 2.28 percent after better-than-expected quarterly profit.
Advancing issues outnumbered decliners on the NYSE by 2,119 to 904. On the Nasdaq, 1,529 issues rose and 1,297 fell.
The S&P 500 index showed 44 new 52-week highs and no new lows, while the Nasdaq recorded 63 new highs and 20 lows.
About 7.1 billion shares changed hands on US exchanges, above the 6.7 billion daily average for the past 20 trading days, according to Thomson Reuters data.