The Dow Jones Industrial Average rose 145 points, led by gains in Chevron. The S&P 500 gained 0.8 percent as the tech sector climbed 1.2 percent. The tech-heavy Nasdaq Composite outperformed, advancing 1.4 percent.
Facebook shares rose more than 2 percent, while Amazon gained 1.9 percent. Apple and Alphabet climbed 0.6 percent and 2 percent, respectively.
These tech shares, which are part of the popular "FAANG" trade, have been under pressure recently. Through Tuesday's close, they were all down more than 20 percent from their 52-week highs, officially in a bear market. The sharp decline in tech helped send the Dow, S&P 500 and Nasdaq all down at least 3 percent for the week.
"Tech stocks have featured prominently in recent equity weakness," Mark Haefele, a strategist at UBS Global Wealth Management Chief Investment Office, said in a note. "But we think it's important to discriminate within tech. The weakness is being driven by slower growth in the consumer IT sector, but the outlook for the enterprise IT sector, which makes up the majority of global tech, is more robust."
U.S. stocks sold off for a second consecutive session on Tuesday, as energy shares dropped with oil prices, while retailers including Target and Kohl tumbled after weaker-than-expected earnings.
Tuesday's declines sent the Dow and S&P 500 to their weakest levels since late October, while the tech-heavy Nasdaq dropped to its lowest level in more than seven months.
"I think we're due for a bounce here," said Tom Essaye, founder of The Sevens Report. "Market sentiment has been pretty negative lately. The major news aggregators are taking notice. That's usually a sign that we're due for a bounce."
Essaye also said pressure is building on the Federal Reserve to slow down its pace for hiking interest rates. "They will still hike in December, but i think 2019 is really up for grabs."
Foot Locker shares surged 15.1 percent after the company reported better-than-expected earnings on Tuesday. Its same-store sales, a key metric for retailers, also topped analyst expectations. Other retailers like L Brands and Office Depot also rose ahead of Black Friday, one of the busiest shopping days of the year in the U.S.
In economic data, durable goods orders fell 4.4 percent in October, more than expected. It also marked the third decline in the past four months. Meanwhile, weekly jobless claims rose to a more than four-month high last week.
—CNBC's Sam Meredith contributed to this report.