The S&P 500 and Nasdaq Composite rose on Thursday as Apple became the first U.S. publicly traded company in history to reach $1 trillion in market value.

The advanced 0.5 percent to 2,827.22, while the tech-heavy Nasdaq jumped 1.2 percent to 7,802.69. The Dow Jones Industrial Average closed just 7.66 points lower at 25,326.16, nearly erasing a 200-point loss.

Apple shares rose 2.9 percent to $207.39 a share, lifting its market cap above the $1 trillion mark. Apple's stock has been on a tear since the company reported stronger-than-forecast quarterly results on Tuesday. Since then, the stock is up nearly 9 percent.

"It's good for confidence in the market to the extent that it's a widely owned stock," said Marc Chaikin, CEO of Chaikin Analytics. "A lot of market-cap weighted ETFs are getting a boost from this."

The major indexes fell earlier in the session as trade worries intensified after the Trump administration threatened to slap bigger tariffs on China.

The U.S. administration announced on Wednesday that President Donald Trump asked U.S. Trade Representative Robert Lighthizer to consider increasing the proposed levies on $200 billion worth of Chinese goods up to 25 percent, from 10 percent.

China's Ministry of Commerce responded to the U.S. announcement saying: "China is fully prepared and will have to retaliate to defend the nation's dignity and the interests of the people, defend free trade and the multilateral system, and defend the common interests of all countries."

Shares of big exporters Caterpillar and Boeing fell 0.4 percent and 0.9 percent, respectively.