The Dow Jones Industrial Average and S&P 500 closed higher on Tuesday as traders booked profits from the major tech names and added to positions in the more beaten-down value stocks.
The 30-stock Dow gained 159.53 points, or 0.6%, to close at 26,840.40. The S&P 500 climbed 0.2% to 3,257.30. Both the Dow and S&P 500 cut their gains in the final 30 minutes of trading. The Nasdaq Composite, meanwhile, dropped 0.8% to 10,680.36 after hitting an intraday record earlier in the day.
Shares of Facebook, Amazon, Netflix, Microsoft and Apple were all down more than 1%. Alphabet shares slid 0.5%. This muted performance comes after a big run-up in July. These stock are all up at least 2.6% month to date.
Bank stocks — which have taken a beating this year — rose broadly. JPMorgan Chase advanced 2.2% and Bank of America advanced 3.6%.
"The price action is the reverse of Monday directionally as cyclicals/value outperform while investors book profits in growth/momentum," wrote Adam Crisafulli of Vital Knowledge. Tuesday's moves came after a strong performance in technology shares that pushed the S&P 500 back into positive territory for 2020.
Sentiment was also lifted Tuesday after the European Commission, the European Union's executive arm, agreed to a 750 billion euro stimulus package. The stimulus is designed to help countries and sectors in the region most affected by the coronavirus pandemic.
In the U.S., investors were monitoring the talks in Washington on the next coronavirus relief bill. Lawmakers face pressure to pass legislation before the end of the month, when the $600 per week federal unemployment insurance benefit is set to expire.
"I believe the stock market would benefit from news of a stimulus package coming to fruition," Kristina Hooper, Invesco's chief global market strategist, said in a note. "In times like this, despite a massive and rising budget deficit for the US, I believe big government is likely to be good news for the stock market."
IBM reported better-than-expected second-quarter earnings. Notably, IBM improved gross margins in three of its five units in the past quarter. The Dow component rose as much as 4.6% before closing 0.3% lower.
Coca-Cola — another Dow component — said its profit fell 33% in the second quarter, but the company expressed optimism on demand as lockdown measures associated with the coronavirus were lifted. Shares rose 2.3%.
Thus far, 58 S&P 500 companies have reported calendar second-quarter earnings and 81% of them have beaten analyst expectations, according to data from Nick Raich of The Earnings Scout. To be sure, Raich pointed out the so-called blended S&P 500 earnings growth estimates — which takes into account the companies that have reported and the forecast for those that haven't — is still showing a drop of 43.61% year over year.
Subscribe to CNBC PRO for exclusive insights and analysis, and live business day programming from around the world.
—CNBC's Michael Bloom contributed to this report.