By Anna Isaac

U.S. stocks jumped Wednesday, putting the S&P 500 back on track to continue this month's rally.

The S&P 500 rose 0.9% in morning trading, pushing the benchmark index to the cusp of a record high last set in February. The move erased losses from Tuesday, its biggest decline in three weeks.

The Dow Jones Industrial Average Average climbed 0.8% and the technology-heavy Nasdaq Composite Index rose 1.1%.

Investors are keeping a close eye on lawmakers' negotiations over a new coronavirus-relief package for American households and businesses. Senate Majority Leader Mitch McConnell said that talks were "at a bit of a stalemate," dimming appetite for stocks and other risky assets on Tuesday.

"Mitch McConnell's comments yesterday implied that we might not be able to see an agreement before Congress goes into recess," said Edward Park, deputy chief investment officer at Brooks Macdonald. "Markets, particularly in the last day or so, seem to be pricing in a stimulus even as lawmakers play down the odds."

Shares of drugmaker Moderna edged up about 2% after it said Tuesday it agreed to provide the U.S. government 100 million doses of its experimental coronavirus vaccine in exchange for more than $1.5 billion. Tesla shares rose 4.6% after the electric-car maker on Tuesday said it would enact a 5-for-1 stock split.

In bond markets, the yield on the benchmark 10-year Treasury note gained for a fourth day, ticking up to 0.668%, from 0.657% Tuesday. The yield on Tuesday had reached its highest level since early July.

Fresh inflation data showed that U.S. consumer prices increased by 0.6% in July, more than the average expectation of 0.3%, according to FactSet.

Gold prices wavered Wednesday, after the commodity on Tuesday fell by the most since March. Analysts said appetite for gold has been eroded this week by the rise in U.S. government bond yields. The precious metal -- usually viewed as a haven asset that investors flock to when stocks are in tumult -- has climbed this year even as equities advanced.

"There's been a breakdown in the relationship between equities and gold, " said Geoff Yu, senior markets strategist at BNY Mellon. "This happens if you believe there's going to be moderate inflation, driven by an increase in productivity from companies."

Brent crude, the international oil benchmark, rose 1.4% to $45.14 a barrel.

Overseas, the pan-continental Stoxx Europe 600 rose 0.5%.

In the U.K., fresh data showed that the country recorded a steeper second-quarter contraction than any other rich nation, signaling that it has suffered the worst economic hit from coronavirus in Europe. The British economy shrank 20.4% in the second quarter, the country's statistics agency said Wednesday. The British pound slipped 0.1% against the dollar and fell 0.5% against the euro.

In Asia, the Shanghai Composite Index fell 0.6% by the close of trading, while Japan's Nikkei 225 rose 0.4%. Hong Kong's Hang Seng Index rose 1.4%.

Ben Eisen contributed to this article.

Write to Anna Isaac at anna.isaac@wsj.com