NEW YORK — A four-day streak of record closes ended for the Standard & Poor’s 500 index Wednesday after Caterpillar reported weak earnings and falling oil prices hurt energy stocks.

Caterpillar, which makes mining and construction equipment, is considered an important barometer of the global economy. The plunge in Caterpillar’s third-quarter profit discouraged investors and stalled a two-week surge in the stock market.

Energy stocks dropped as the price of oil fell to its lowest in almost four months.

The S&P 500 fell 8.29 points, or 0.5 percent, to 1,746.38, ending its longest streak of record closes since mid-May.

The S&P 500 had surged 6 percent over the previous two weeks, capped by a record close of 1,754.67 on Tuesday.

The index climbed as lawmakers inched toward a deal to end a 16-day partial government shutdown and avert a potential U.S. default. Investors also became more convinced that the Federal Reserve would refrain from pulling back on its economic stimulus until possibly next year.

Energy stocks fell the most of the 10 industry groups in the S&P 500. The price of oil slipped $1.44, or 1.5 percent, to $96.86 a barrel, on higher supplies of U.S. oil and weak demand for fuel.

In other trading Wednesday, the Dow Jones industrial average fell 54.33 points, or 0.4 percent, to 15,413.33.

The index of 30 leading U.S. companies hasn’t rallied like the S&P 500 index, and remains 263 points below its own all-time closing high reached on Sept. 18.