U.S. stocks edged up on Wednesday as Iran's plans to release captured British troops led to a decline in oil prices and positive brokerage comments boosted Microsoft Corp. (MSFT).

Data pointing to services sector weakness and slower-than-expected growth in factory orders revived concerns about the economy and kept a lid on gains.

The Dow notched its fifth day of gains, its longest winning streak since mid-March, while the S&P rose for a third straight day.

Click here to visit FOXBusiness.com's Investing page.

The news from Iran, the world's fourth-largest oil exporter, that it would free the 15 captured British sailors and marines it has held more than a week eased global tensions and helped push down oil prices.

Citigroup said it raised its fiscal third-quarter earnings estimates for Microsoft after the software maker's successful launch of the Windows Vista operating system. For details, see Microsoft shares gained 2.3 percent, boosting the three major indexes.

"Iran is supportive for the markets. That's a problem that's not there anymore — until the next incident," said Frank Lesh, a futures analyst and broker at FuturePath Trading LLC in Chicago.

"I'm impressed by way the market held up with some of the economic news we'd had. The data was off a little bit, and we're up a little bit," he said.

The Dow Jones industrial average gained 19.75 points, or 0.16 percent, to end at 12,530.05. The Standard & Poor's 500 Index was up 1.60 points, or 0.11 percent, at 1,439.37.

The Nasdaq Composite Index was up 8.36 points, or 0.34 percent, at 2,458.69, its fifth up day and its longest winning streak since early January.

U.S. crude oil for May delivery fell 26 cents to settle at $64.38 a barrel.

Shares of Monster Worldwide Inc. (MNST), parent of jobs Web site Monster.com, were down 13.2 percent at $42.10 and among the top negatives on the S&P and Nasdaq. The company said it expects first-quarter revenue to fall below its prior forecast.

Analysts said the drop reflects fears that U.S. hiring may be slowing faster than had been expected. Other staffing stocks also fell, including Labor Ready Inc. (LRW), down 6.7 percent at $17.85.

The Institute for Supply Management said its index of non-manufacturing industries showed growth in the vast services sector last month tumbled to its weakest pace in four years, below even the most bearish forecast in a Reuters survey. In addition, the report showed a rise in an inflation measure.

New orders at U.S. factories rose by a weaker-than-expected amount in February as orders for machinery and metals fell, the Commerce Department said.

Shares of companies seen positioned to withstand slowing economic growth, including tobacco maker Altria Group Inc. (MO), advanced.

Shares of Altria, which on Friday completed its spin-off of Kraft Foods Inc. (KFT), notched their third straight day of gains, up 1.1 percent at $70.44 on the NYSE.

Diversified health-care company Johnson & Johnson (JNJ) rose 1.1 percent to $61.29, also on the NYSE after a brokerage recommended the stock.

Microsoft shares rose 63 cents to $28.50.

Trading was below average on the NYSE, with many traders absent because of the Passover and Easter holidays. About 1.40 billion shares changed hands on the NYSE, below last year's estimated daily average of 1.84 billion. On Nasdaq, about 1.78 billion shares traded, below last year's daily average of 2.02 billion.

Advancing stocks outnumbered declining ones by a ratio of about 9 to 7 on the NYSE. On the Nasdaq, decliners beat advancers by 15 to 14.

Click here to visit FOXBusiness.com's Investing page.