NEW YORK – Wall Street ended its second straight winning week with a moderate advance yesterday, overcoming concerns about consumer confidence and inflation.

After slumping early in the session in response to weak consumer confidence and a spike in oil prices, investors seemed to turn their attention to broader signs, including the week's generally satisfactory earnings reports, that suggested that government efforts to steady the economy appear to be working. That shift in focus sent stocks up late in the day.

Although the Reuters/University of Michigan consumer sentiment index came in with its lowest reading since the early 1980s, Tom Lydon, president of Global Trends Investments, said companies' first-quarter reports convinced investors that “overall, things aren't all that bad.”

“I think a lot of people went into the weekend feeling they didn't want to be on the short side,” Lydon said.

The consumer sentiment index fell to 62.6 for April from 69.5 a month earlier, reflecting Americans' concern about rising energy and food prices.

The Dow Jones industrial average gained 42.91, or 0.33 percent, to 12,891.86, after falling more than 100 points early in the session. The Dow closed the week with a gain of less than 1 percent.

Broader stock indicators were mixed on the day. The S&P 500 index gained 9.02, or 0.65 percent, to 1,397.84, and rose 2.1 percent for the week.

The Nasdaq composite index, depressed by disappointment with a Microsoft Corp. forecast, fell 5.99, or 0.25 percent, to 2,422.93, after dropping as much as 1.6 percent during the session. But advancers were well ahead of decliners in the broader Nasdaq Stock Market, and for the week, the Nasdaq gained 1.4 percent.

Advancing issues outpaced decliners by 2 to 1 on the New York Stock Exchange. Consolidated volume came to 3.72 billion shares, down from 4.34 billion shares on Thursday.

Bond prices fell ahead of the Federal Reserve's meeting on interest rates next Wednesday. The yield on the benchmark 10-year Treasury note rose to 3.87 percent from 3.83 percent Thursday.

Oil prices, meanwhile, jumped on a series of events overseas, including word that a ship under contract with the U.S. Navy fired flares and warning shots at two small boats of unknown origin in the Persian Gulf. Oil was up earlier after an attack on a pipeline in Nigeria and a looming refinery strike in Scotland; light, sweet crude shot as high as $119.50 a barrel on the New York Mercantile Exchange before falling back to settle at $118.52, up $2.46.

Microsoft fell $1.97 to $29.83 after its first-quarter report. The tech leader said after the closing bell Thursday that worldwide sales next year should offset weakness in the U.S. economy.