The Dow Jones Industrial Average closed higher Wednesday but gave up much of an afternoon rally after CNBC reported that a dispute between Sen. Bernie Sanders and Republicans over unemployment aid could cause the coronavirus aid bill to be delayed.

Still it was the first back-to-back gain since the outbreak set off a brutal sell-off five weeks ago.

The S&P 500 rose 1.2% after being up 5.1% earlier on hopes the package would be passed soon.

The market is down by about a quarter from its record high set last month. Investors expect markets to remain volatile until the number of new cases peaks.

The Dow Jones Industrial Average closed up 495.64 or 2.39% to 21,200.55.

The NASDAQ composite index closed slightly down 33.56 or .45% to 7,384.30.

The S&P 500 was up 28.23 or 1.15% to 2,475.56.

Stocks climbed at the opening bell after Congress and the White House announced a deal overnight Wednesday to inject nearly $2 trillion of aid into an economy ravaged by coronavirus.

The Dow Jones Industrial Average led the way, opening about 2% higher a day after seeing its best rise since 1933.

Previously

On Tuesday the Dow closed with an 11.4% gain at 20,704.91, while the more closely followed S&P 500 index, which is vital for most 401(k) accounts, leaped 9.4% to 2,447.33. The Nasdaq composite jumped 8.1%, to 7,417.86.

What it means

The gains this week have been a respite from a brutal month of nearly nonstop selling. But with cases of the virus still climbing, investors are leery of saying markets have hit bottom. Rallies nearly as big as this have punctuated the last few weeks, none lasting more than a day.

Ultimately, investors say they need to see the number of new infections peak before markets can find a floor. The increasing spread is forcing companies to park airplanes, shut hotels and close restaurants to dine-in customers.

Pressure was on Congress to act after the Federal Reserve has done nearly all it can to sustain markets.

After much partisan haggling, the breakthrough on the sweeping $2 trillion measure to aid American workers, businesses and a health care system strained by the rapidly spreading coronavirus outbreak was an expected but welcome boost to sentiment.

The deal still needs to be finalized in detailed legislative language, but would give direct payments to most Americans, expand unemployment benefits and provide a $367 billion program for small businesses to keep making payroll while workers are forced to stay home.

World markets

Most world markets soared after news of the U.S. stimulus deal broke overnight.

Japan's Nikkei 225 surged 8%, its biggest daily gain since 2008. Share prices there were lifted also by the decision to postpone the 2020 Olympics to July 2021 in view of the coronavirus pandemic, which has brought travel almost to a standstill and is leaving many millions of people ordered to stay home to help contain the outbreaks.

The postponement alleviated fears the event might be cancelled altogether.

A day earlier, European markets rallied at the open but lost their shine by midday, with the CAC 40 in Paris picked up 0.6% to 4,266. Britain's FTSE 100 added 1% to 5,500. Germany's DAX shed 0.9% to 9,612.

On Wednesday, the Hang Seng rose 3.8% to 23,527.19. South Korea’s Kospi gained 5.9% to 1,704.76 and the S&P/ASX 200 gained 5.5% to 4,998.10. The Shanghai Composite index rose 2.2% to 2,781.59. Taiwan’s benchmark jumped 3.8%. Shares were also higher in Southeast Asia.

India’s Sensex jumped 6.8% after Prime Minister Narendra Modi ordered the world's largest democracy into the world's biggest lockdown Wednesday. India's 1.3 billion people were ordered to stay home in a bid to stop the coronavirus pandemic from spreading and overwhelming its fragile health care system as it has done elsewhere.

Governments elsewhere have also tightened restrictions on business activity and movement as the toll from the virus has surged higher.

What’s next

Its unclear how long-lasting the damage from the outbreak will be on economies. Governments and central banks in other countries around the world are unveiling unprecedented levels of support for their economies in an attempt to limit the scale of the upcoming virus-related slump.

Measures of the shock to the world economy are accumulating.

On Thursday, economists expect a report to show the number of Americans applying for jobless claims easily set a record last week. Some say the number could be way beyond 1 million, amid a wave of layoffs, topping the prior record of 695,000 set in 1982.

— This report was compiled by ArLuther Lee for The Atlanta Journal-Constitution.