Some hard-hit countries, including Italy, as well some US states including California are tentatively easing lockdown orders this week, raising hopes for a recovery in oil demand.
Healthcare shares led among S&P 500 sectors following developments in efforts to control the coronavirus from Pfizer and Regeneron Pharmaceuticals.
"We are starting to see some states open up, we are starting to see some activity," said Paul Nolte, portfolio manager at Kingsview Investment Management. "We are probably now in the midst of the worst period and things will be gradually improving from here."
The Dow Jones Industrial Average rose 133.33 points, or 0.56%, to 23,883.09, the S&P 500 gained 25.7 points, or 0.90%, to 2,868.44 and the Nasdaq Composite added 98.41 points, or 1.13%, to 8,809.12.
Shares of large tech and internet companies such as Microsoft and Apple also gained, giving lifts to the indexes.
Pfizer shares rose 2.4% after the drugmaker said it and its German partner had begun delivering doses of an experimental coronavirus vaccines for human testing. Regeneron Pharmaceuticals shares gained 6.0% after the company said its experimental antibody cocktail for COVID-19 may be available for use by the end of summer.
Clarida said during an interview with CNBC that the US economy is likely to contract sharply during the second quarter as a result of intentional business shutdowns, but there is a chance the recovery could start in the second half of the year.
"Clarida threw a bit of a wet blanket on the market at the end of the session," said Michael Antonelli, market strategist at Robert W. Baird in Milwaukee.
Data on Tuesday showed the vast US services sector fell into contraction in April for the first time in nearly 10-1/2-years.
In corporate news, shares of Norwegian Cruise Line Holdings Ltd tumbled 22.6% as the world's third-largest cruise operator raised doubts about its ability to keep running as a business.
Advancing issues outnumbered declining ones on the NYSE by a 1.52-to-1 ratio; on Nasdaq, a 1.18-to-1 ratio favored advancers.
The S&P 500 posted 11 new 52-week highs and two new lows; the Nasdaq Composite recorded 46 new highs and 12 new lows.
About 10.6 billion shares changed hands in US exchanges, below the roughly 12 billion daily average over the last 20 sessions.