Stocks bounced back to record highs Tuesday as investors put an end to a two-day drop for technology companies. Energy and consumer-focused companies also made outsize gains.

In a reversal from the two previous days, investors put money into companies that stand to benefit from faster economic growth, including retailers, makers of basic materials like paints and chemicals, energy companies and banks. Big-dividend companies, which are usually considered safer investments, did not do as well as the rest of the market.

advertisement | advertise on newsday

Tech companies reversed their losses from Monday, although they remain well below their peak from last week.

“There’s no question that the rally in that sector can continue as long as investors’ sentiment remains positive,” said Brian Rehling, co-head of global fixed income strategy at Wells Fargo Investment Institute. Rehling said he believes tech stocks are a bit too high, but not by a huge amount.

The Standard & Poor’s 500 index picked up 10.96 points, or 0.5 percent, to 2,440.35. The Dow Jones industrial average rose 92.80 points, or 0.4 percent, to 21,328.47.

The Nasdaq composite, which has a large concentration of technology companies, rose 44.90 points, or 0.7 percent, to 6,220.37, but did not get back to its record highs.