U.S. stocks notched their biggest quarterly gains in nearly a decade, lifted by bets that central banks would hold interest rates at low levels as global growth slows.

Major indexes have now recouped almost all of the losses they suffered in the final months of 2018, when fears about an economic downturn sent markets around the world sliding.

Much...