dow
The Dow Jones Industrial Average inched higher Thursday, roughly 25 points from its record closing high set on Tuesday, as Apple Inc.(NASDAQ:AAPL) shares gained 1 percent. Reuters/Lucas Jackson

U.S. stocks closed higher Thursday, with the S&P 500 index hitting a record closing high. Thursday’s gains were driven by the energy sector, as all 10 sectors in the S&P 500 traded higher, except for the financial sector, which closed flat.

The S&P 500 also hit a new intraday high of 2,134.28.

The Nasdaq composite came within just 1 point of its record closing high, while the Dow Jones Industrial Average was within roughly 25 points off its all-time high, set on Tuesday.

The Dow (INDEXDJX:.DJI) added 0.34 points, or 0.0 percent, to close at 18,286. The Standard & Poor's 500 (INDEXNASDAQ:.IXIC) rose 4.97 points, or 0.23 percent, to 2,130.82. The Nasdaq composite (INDEXSP:.INX) gained 19.05 points, or 0.38 percent, to reach 5,091.

Tech giant Apple Inc. (NASDAQ:AAPL) and Caterpillar Inc. (NYSE:CAT), the world’s largest manufacturer of construction and mining equipment, led the Dow higher Thursday, closing up 1 percent and 1.6 percent, respectively.

Morgan Stanley raised its forecasts for Apple's iPhone sales in the current quarter to 50 million from 46 million, boosted by "strong demand from existing iPhone users, with nearly half of the installed base planning to upgrade [this year]," analyst Katy Huberty said in a research note.

Morgan Stanley also said U.S. demand for the Apple Watch has jumped by 60 percent since March, according to the firm’s AlphaWise U.S. Wearables survey. Huberty expects Apple to sell 36 million units of the watch in the first 12 months it’s on sale, compared with a previous 30 million unit estimate.

Huberty maintained her 12-month price target of $166. Shares of Apple rose just over 1 percent Thursday to close at $131.39.

McDonald's Corporation (NYSE:MCD) was the largest decliner in the blue-chip index, ending down nearly 1 percent.

The S&P 500 energy sector gained nearly 1 percent Thursday, led by gains from Noble Corp plc (NYSE:NE) and Chesapeake Energy Corporation (NYSE:CHK), rising 4.5 percent and nearly 4 percent, respectively.

Shake Shack Inc. (NYSE:SHAK) soared 8 percent Thursday to close at an all-time high of $89.87 as the fast-casual burger joint explores adding chicken sandwiches to its menu, according to a recent filing. The stock hit a new high of $90.52 during the trading session.

Shares of Salesforce.com Inc. (NYSE:CRM) rose about 4 percent after the cloud-computing company’s earnings topped Wall Street estimates, with the company also boosting its full-year earnings forecast on increased subscription and services revenue.

Amazon.com Inc. (NASDAQ:AMZN) rose nearly 2 percent Thursday after the e-commerce giant announced its Amazon Prime Now service is offering one-hour delivery from local stores in Manhattan, including groceries, meals and baked goods, through the Amazon Prime Now app.

Lumber Liquidators Holdings Inc. (NYSE:LL), the largest U.S. retailer of hardwood flooring, saw its shares plunge 16.5 percent Thursday, to a 52-week low of $20.92, after CEO Robert Lynch unexpectedly resigned.

Economists are looking ahead to Friday’s economic calendar, which includes the U.S. Commerce Department’s consumer price index for April, which the Federal Reserve watches to assess price changes associated with the cost of living.