NEW YORK - A tough week on the stock market ended quietly Friday. Major indexes notched modest gains, not nearly enough to make up for the four previous days of losses. It wound up being the second-worst week for the market so far this year.

The Dow Jones industrial average remains down slightly for 2015, and the Standard & Poor's 500 index is essentially flat.

The Dow Jones industrial average rose 34.43 points, or 0.2 percent, to 17,712.66. The S&P 500 rose 4.87 points, or 0.2 percent, to 2,061.02; the Nasdaq composite rose 27.86 points, or 0.6 percent, to 4,891.22.

Stocks fell most of the week due to a combination of weaker-than-expected economic data and concerns that the rapid rise of the dollar may crimp U.S. corporate earnings.

The biggest sell-off came Wednesday, when a report showed orders at U.S. factories for long-lasting manufactured goods fell in February, the latest disappointing data suggesting the U.S. economy has hit a soft patch. The Dow plunged nearly 300 points that day.

While the price of U.S. crude fell sharply Friday, it still finished much higher for the week, up more than 10 percent. It was the biggest weekly gain for oil since March 2009.

Benchmark U.S. crude fell 5 percent, or $2.56, to close at $48.87 a barrel in New York. Brent crude, a benchmark for international oils used by many U.S. refineries, fell 7 cents to close at $56.41 in London. In other futures trading, natural gas fell 8.2 cents to close at $2.590 per 1,000 cubic feet.

Prices for U.S. government bonds rose. The yield on the 10-year Treasury fell to 1.96 percent from 1.99 percent late Thursday.

In the metals market, gold fell $5 to $1,299.80 an ounce, silver fell 7 cents to $17.07 an ounce, and copper fell 4 cents to $2.77 an ounce.