Investors took a chance on some beaten-down shares on Thursday, helping the U.S. stock market to its first gain in four days.

The gain was modest, but broad, with eight of the 10 industry sectors of the Standard and Poor’s 500 index ending higher. Drillers and other energy companies, down sharply in previous days, climbed 0.6 percent, much more than the rest of the market. Among individual stocks, Chevron rose nearly 2 percent.

advertisement | advertise on newsday

Some suppliers of raw materials posted gains, too. Aluminum giant Alcoa and miner Freeport-McMoRan each rose 5 percent.

The climb came despite a continuing slump in the price of commodities that has been rattling markets all year. Benchmark U.S. crude oil fell to another seven-year low.

The Dow Jones industrial average climbed 82.45 points, or 0.5 percent, to 17,574.75. The S&P 500 index rose 4.61 points, or 0.2 percent, to 2,052.23. The Nasdaq composite increased 22.31 points, or 0.4 percent, to 5,045.17.

The price of crude oil fell 40 cents, or 1 percent, to $36.76 a barrel in New York. Oil is trading at its lowest level since early 2009.