NEW YORK — U.S. stocks climbed Tuesday as the price of oil made its biggest jump in seven months and energy companies rose with it. Technology stocks like Microsoft and Google’s parent Alphabet traded higher and bond yields slipped, a break with the pattern since last week’s election.

Oil rose almost 6 percent as investors again grew hopeful that the OPEC cartel will agree to cut fuel production in a few weeks. Companies like utilities and telecom service providers climbed as bond yields fell slightly after a week of large gains. Airlines rose after Warren Buffett made a surprise investment in three carriers.

“The market somehow decided ‘let’s give the Trump presidency a chance,’ ” said John DeClue, chief investment officer for U.S. Bank’s private client reserve. However DeClue said the bond market could struggle with Donald Trump in the White House: If taxes are cut and government spending rises, that could lead to climbing deficits that would trouble investors in U.S. government debt.

The Dow Jones industrial average picked up 54.37 points, or 0.3 percent, to 18,923.06, as those gains were partly held back by losses for retailer Home Depot and aerospace company Boeing. The Standard & Poor’s 500 index rose 16.19 points, or 0.7 percent, to 2,180.39. The Nasdaq composite added 57.23 points, or 1.1 percent, to 5,275.62.

Energy companies like Exxon Mobil and Occidental Petroleum made large gains as the price of oil rose by the largest amount since early April. At least for a day, investors were hopeful that the nations of OPEC will be able to hammer out a deal to cut oil production, which would boost prices.

Tuesday’s trading was a partial reversal of the moves investors have made since the presidential election one week ago.