Stocks eked out small gains in volatile trading Thursday, lifted by materials, as investors digested the latest round of corporate earnings.
(Read more: After-hours buzz: Amazon, Starbucks, Zynga & More)
"The late morning recovery in the 10 Year Note helped bring back the buyers in stocks," wrote Elliot Spar, market strategist at Stifel Nicolaus. "The ability of the DJ Transports and the SOX to hold their respective 50-day moving averages was a plus as well. All the major averages, the Dow, S&P 500, Russell 2000 and Nasdaq Comp all slipped below their respective 10-day moving averages this morning but they have retaken them."
The Dow Jones Industrial Average eked out a gain of 13.37 points, to close at 15,555.61, led by Chevron. Home Depot and Microsoft led the laggards.
The S&P 500 edged up 4.31 points, to end at 1,690.25. The Nasdaq rallied 25.59 points, to finish at 3,605.19, seeing its best gain in nearly two weeks. The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, ended near 13.
(Read more: Small caps pose the latest threat to market rally)
Meanwhile, the Dow Transportation index traded lower for the fourth-consecutive session, testing its 50-day moving average. The move could be troubling to Dow theorists who say the Dow Jones Industrial Average and the Dow Jones Transportation index move in lockstep to reach new highs or lows. But when they diverge, the market usually goes back to its former trading range.
Most key S&P sectors finished in positive territory, boosted by materials and utilities, while industrials closed flat.
Among earnings, Facebook surged nearly 30 percent after the social-networking giant posted stellar quarterly results and nearly 20 brokerages raised their price targets on the stock. The stock traded at its best level since last May and is about 10 percent from hitting its IPO price of $38. A shocking 230 million shares have traded hands so far, the largest since the company went public last May.
(Read more: Cramer: A 'straightshot' to $38 for Facebook)
General Motors earnings expectations, helped by strong demand in North America and cost cutting in Europe. But shares of the U.S. automaker finished largely unchanged. Dow component 3M edged past earnings expectations and backed its full-year profit forecast. But shares of the diversified manufacturer still declined.
PulteGroup tumbled to lead the S&P 500 laggards after the homebuilder missed Wall Street expectations and the company said the number of homes booked dropped 12 percent. Rival D.R. Horton, meanwhile, reported better-than-expected earnings as it sold more units at higher prices. But shares still fell sharply.
Crocs plunged after the footwear manufacturer posted quarterly results that fell short of expectations and handed in current-quarter outlook that sharply missed expectations.
"A lot of market-moving day-to-day moves are based on earnings hits versus misses, but I look at overall earnings growth," said Karyn Cavanaugh, market strategist with ING U.S. Investment Management. "So far, we're up 5 percent, versus 3 percent last quarter, so this is a testament to American companies and their ability to get over these hurdles."
To date, more than 45 percent of S&P 500 companies have reported results so far this quarter, with 68 percent of firms topping earnings expectations and 56 percent beating revenue estimates, according to data from Thomson Reuters. If all remaining companies report earnings in line with estimates, earnings will be up 4.1 percent from last year's second quarter.
Looking ahead to the third and fourth quarters, Cavanaugh said companies haven't been lowering the earnings bar, which is an encouraging sign that growth will likely continue.
"I see the market hitting new highs for the year and we'll probably end higher than where we are now, barring any major global event or political wrangling," added Cavanaugh, who has a price target of 1,760 on the S&P 500.
On the economic front, weekly jobless claims increased by 7,000 to a seasonally adjusted 343,000, according to the Labor Department. Economists had expected a reading of 340,000 last week. Still, the four-week average of new claims dipped 1,250 from a week earlier.
And durable goods orders gained more than expected, with non-defense capital goods orders excluding aircraft rising 0.7 percent in June, according to the Commerce Department, edging past expectations for an increase of 0.5 percent.
The Treasury auctioned $29 billion in 7-year notes with a high yield of 2.026 percent. The bid-to-cover ratio, an indicator of demand, was 2.54, versus a recent average of 2.65.
European shares finished in the red with investor confidence curbed by a mixed bag of earnings from major companies and concerns about slowing growth in China.
And Asian markets ended lower, even as the Chinese government announced new measures to lift certain areas of the economy, including small businesses.
—By CNBC's JeeYeon Park (Follow JeeYeon on Twitter: @JeeYeonParkCNBC)
On Tap This Week:
FRIDAY: Consumer sentiment, AT&T Next debuts; Earnings from Tyco
What's Trending on CNBC.com: