New York: With all three indexes rallying for the fifth straight day, Wall Street on Friday finished its best week in nearly two years, as reported. The Dow Jones industrial average ended at 12,582.77, gaining 5.3 percent for the past week and wiping out all of June's losses.

The broader Standard & Poor's 500 rose 19.03 points, or 1.44 percent, to 1,339.67, up 5.5 percent for the week, and the Nasdaq Composite Index rallied 42.51 points, or 1.53 percent, to 2,816.03, gaining about 6 percent on week.

Energy stocks led the way in this week-long rally, gaining more than 7 percent, while technology, consumer discretionary and industrial sectors all rose more than 6 percent.

Friday's strength came after the Institute for Supply Management said its manufacturing purchasing managers' index rose to 55.3 in June from 53.5 in May, which marked the 23rd consecutive month of expansion.

Other data came in was not that upbeat, but did little to hold the rally. US construction spending in May hit a nearly 12-year low, suggesting the sector will remain a drag on the economy.

Meanwhile, Thomson Reuters/University of Michigan survey showed that the final reading for the consumer sentiment index came in at 71.5 in June, down from 74.3 the month before.

Signs of economic slowdown in China had little impact on the market either after data showed the manufacturing sector expanded at the slowest pace since February 2009, partly because most economists believed the growth in China will be still robust enough and the current slowdown is good for its economy.

Analysts believed short-covering activities provided the strength for the five-day rally as concerns over Greece debt default were allayed and manufacturing data came in stronger than expected.

With confidence gradually being restored, investors shifted more money out of safe-haven bonds and into other, higher- yielding assets such as stocks and commodities.

In other markets, light, sweet crude for August delivery fell 48 cents, or 0.5 percent to settle at $94.94 a barrel on the New York Mercantile Exchange. For this week, it rose $3.78 or 4.15 percent.

US financial markets will be closed Monday for the July 4th holiday and resume trading on Tuesday.

(Agencies)