U.S. stock indexes climbed and government-bond yields fell after inflation data showed that consumer prices rose at the fastest annual pace in four decades in March, largely driven by a surge in energy prices.

The S&P 500 rose 1%, the Dow Jones Industrial Average edged up 0.8% and the technology-heavy Nasdaq Composite rose 1.4%. The gains marked a course reversal from Monday when major indexes retreated, with the benchmark S&P 500 losing 1.7%.