(Retuers) -- The S&P 500 closed at a five-month high for the third day on Thursday, but had difficulty extending gains in the face of lackluster economic data and another European bond market test.

The Dow Jones industrial average <.DJI> was up 21.57 points, or 0.17 percent, to end unofficially at 12,471.02. The Standard & Poor's 500 Index <.SPX> was up 3.02 points, or 0.23 percent, to finish unofficially at 1,295.50. The Nasdaq Composite Index <.IXIC> was up 13.94 points, or 0.51 percent, to close unofficially at 2,724.70.

(Reporting by Ryan Vlastelica; Editing by Jan Paschal)