Tech stocks are on quite a tear. On Monday, they posted their best two-week return in more than two decades, pulling out in front of the broader market. But some analysts and investing pros said a major threat to that streak is looming on the horizon: second-quarter earnings.
The Nasdaq jumped 5 percent over 10 days of trading ended July 15, with Apple, its largest weighting, up more than 8 percent, and Amazon rising 11 percent. That marked the best two-week rally for the tech-heavy index since 1990. In comparison, the Standard & Poor's 500-stock index rose 3.8 percent.
And though tech has spent most of 2013 underperforming the broader market—as investors clung to high-dividend payers and defensive sectors such as consumer staples, utilities and health care—it is suddenly the top performer.
Year-to-date, Nasdaq has soared 19 percent, versus 17.5 percent for the S&P. And since bottoming out during the financial crisis in 2009, tech stocks are up an astounding 183 percent, versus the broad market's 147 percent and the Dow's 136 percent.
Despite those gains, however, the Nasdaq is still trading at about 3,600 on Wednesday—well below the peak of 5,048, which it hit on March 10, 2000, right before the tech bubble burst.
(Read more: Earnings preview: Bad news ahead for IBM, Intel?)
And some analysts said this rally could come to an abrupt end, too, as tech companies begin reporting earnings this week. Technology is not expected to report a strong quarter, according to Thomson Reuters, with analysts on average projecting a 3.7 percent decline in earnings per share—which would be its worst quarter since 2009.
Brian Marshall, technology analyst with ISI Group, said the global macro outlook doesn't look great, with Europe still in recovery mode. Marshall also says IT spending probably will pause because of "uncertainty on how to implement public cloud into existing IT architecture."
Another headwind facing tech firms is the strengthening dollar, which could hit exports.
"A stronger dollar will make U.S. corporations' tech products and services less competitive overseas," said Enis Taner, who edits the Risk Reversal blog.
(Read more: Yahoo revenue outlook disappoints; shares fall)
—By CNBC's Seema Mody. Follow her on Twitter: