The Dow Jones Industrial Average advanced 235.57 points (1.47 percent) to 16,284.70, while the broad-based S&P 500 rose 35.94 (1.91 percent) to 1,920.03.
The tech-rich Nasdaq Composite Index jumped 102.84 (2.28 percent) to 4,620.16, notching its first increase in seven sessions.
Analysts said weak eurozone inflation data lifted expectations for more stimulus from the European Central Bank. They also pointed to technical factors behind Wednesday's strong gains after US markets tested an August low on Tuesday, but failed to breach it.
Despite the strong rallies, the Dow lost 7.56 percent in the quarter, while the S&P 500 fell 6.94 percent and the Nasdaq 7.35 percent.
The third quarter was the worst three-month stretch in four years for the S&P 500, according to S&P Dow Jones Indices.
Sentiment has been dented by worries about the slowing Chinese economy and concerns about a US Federal Reserve plan to raise interest rates in 2015.
Goldman Sachs also recently cited the "unstable" political environment in Washington, predicting that an upcoming debate on raising the US debt limit will be "contentious and may rattle investors."
Some of the most robust gains came among slumping pharmaceutical shares, such as Allergan (+7.8 percent), Valeant International (+12.8 percent) and Biogen (+4.9 percent).
Some large industrial stocks were also strong, including Chevron (+3.5 percent), Dow Chemical (+4.5 percent) and General Electric (+2.7 percent).
Data-storage company Western Digital surged 14.5 percent on news that Chinese technology company Unisplendour Corporation will pay $3.78 billion for a 15 percent stake in the US company.
Twitter jumped 5.3 percent following a report that co-founder and interim chief executive Jack Dorsey will stay on as CEO, bringing an end to the company's search for a top executive.
Luxury fashion company Ralph Lauren Corporation powered 13.6 percent higher on news that founder Ralph Lauren would step down as chief executive and appoint Gap executive Stefan Larsson as his replacement. Gap fell 5.7 percent.
Bond prices were mixed. The yield on the 10-year US Treasury fell to 2.04 percent from 2.06 percent Tuesday, while the 30-year held steady at 2.86 percent. Bond prices and yields move inversely.