U.S. stocks ended a three-day losing streak on Wednesday, as recent underperformers led a rally not seen as strong enough to overcome worries about waning global demand.

The Dow Jones industrial average <.DJI> unofficially closed up 38.45 points, or 0.31 percent, at 12,394.66. The Standard & Poor's 500 Index <.SPX> added 4.19 points, or 0.32 percent, to finish unofficially at 1,320.47.

The Nasdaq Composite Index <.IXIC> gained 15.22 points, or 0.55 percent, to close unofficially at 2,761.38.

(Reporting by Leah Schnurr; Editing by Jan Paschal)