NEW: Stocks close higher as receding debt fears spur rally

Technology companies helped lift stocks on Wall Street broadly higher Thursday as investors welcomed the end of a standoff in Congress over extending the federal debt ceiling.

An agreement to temporarily extend the government’s borrowing authority into December gives lawmakers more time to reach a permanent solution, averting for now an unprecedented federal default that experts say would have devastated the economy.

ExploreU.S. jobless claims fall to 326,000, first drop in 4 weeks

The S&P 500 rose 0.8%, its third consecutive gain. Nearly 80% of stocks within the benchmark index gained ground. The Dow Jones Industrial Average rose 1%, while the tech-heavy Nasdaq closed 1.1% higher.

The debt ceiling debate and the potential for an unprecedented federal default are among many concerns that have been weighing on the market. Those worries sent the benchmark S&P 500 swinging between daily gains and losses of more than 1% for four days.

Senate leaders announced an agreement Thursday to extend the government’s borrowing authority into December. The move came a day after Senate GOP leader Mitch McConnell made an offer that paved the way for the emergency extension of the debt ceiling.

The temporary compromise between Republicans and Democrats may have also helped give investors optimism that Congress can work out compromises in other areas, said Greg Bassuk, CEO at Axs Investments.

“The fact that it actually got done, we think, frankly, that we are seeing an outsized reaction in the markets today because of the sentiment that, ‘Hey, maybe some more can get done as well,’” he said.

The S&P 500 rose 36.21 points to 4,399.76. The Dow gained 337.95 points to 34,754.94, and the Nasdaq added 152.10 points to 14,654.02.

Small company stocks, a gauge of confidence in economic growth, also notched gains. The Russell 2000 index picked up 35.14 points, or 1.6%, to 2,250.09. Markets in Europe and Asia also closed broadly higher.

Technology stocks powered a big share of the S&P 500′s gains. Apple rose 0.9%, and chipmaker Nvidia added 1.8%.

Automakers were big winners among consumer discretionary sector stocks. Ford Motor rose 5.5%, and General Motors gained 4.7%.

Health insurers helped lift health sector companies. Humana rose 2.9%, while UnitedHealth Group added 2.7%.

Cruise lines were among the market’s decliners. Norwegian Cruise Line fell 2.2%, and Carnival slid 1.7%. Royal Caribbean dropped 1.4%.