Stocks fluctuated Thursday but ended the day with modest gains as investors assessed some mixed news on company earnings. Energy stocks rose as oil recouped some of its losses from a big sell-off on Wednesday.

At the close on Wall Street, the Dow Jones industrial average was up 56.2 points, about 0.3 percent, at 17,958.7. The Standard & Poor's 500 index gained 9.3 points, about 0.5 percent, to 2,091.2. The Nasdaq composite added 23.7 points, about 0.6 percent to 4,974.6.

As the markets closed, the price of oil was up 23 cents at $50.65 a barrel on the New York Mercantile Exchange.

EARNINGS FOCUS: Company earnings will be an important focus for the market in the coming weeks. Companies in the S&P 500 are expected to report that average earnings per share shrank by 3.1 percent in the first quarter, according to S&P Capital IQ. If the forecast proves accurate, it will be the first time since 2009 when the U.S. economy was emerging from the Great Recession that earnings have contracted.

THE QUOTE: "If the U.S. market is going to advance this year, it's going to need to advance mostly on the back of earnings," said Russ Koesterich, chief investment strategist at BlackRock. "That has been a struggle so far."

METAL TEST: Alcoa posted a first-quarter profit that beat Wall Street expectations, but its revenue fell short. The company is striving to transform itself from an aluminum maker into a supplier for the auto and aerospace industries, making it less sensitive to swings in commodity prices. Analysts were disappointed by the outlook for the company's rolled products, which include sheets used for drinks and food cans. Alcoa's stock closed down 46 cents $13.21.

DISAPPOINTING GUIDANCE: Bed Bath & Beyond slumped $4.22 to close at $73.46 after reporting earnings for its fiscal fourth quarter that were below the expectations of Wall Street analysts. The company's earnings outlook was also less than analysts had been expecting. Wedbush analyst Seth Basham described the outlook as "somber" and said the company's profitability was being increasingly threatened by online competition.

advertisement | advertise on newsday

GREEK DRAMA: Investors in Europe were relieved also by confirmation that Greece had met a debt repayment to the International Monetary Fund despite the country's cash crunch. It paid about 450 million euros on Thursday even as it is waiting for more rescue loans from its European state creditors.