U.S. stock indexes flipped between small losses and gains Tuesday, with the market nearly evenly split between winners and losers.

Raw-material producers sank sharply on worries that higher costs and weakening demand are eroding profits. But energy stocks climbed with the price of oil, and technology stocks recovered some of the sharp losses caused by last week’s rapid rise in interest rates.

Treasury yields dipped in this week’s first day of bond trading following a holiday on Monday.

KEEPING SCORE: The S&P 500 was virtually flat at 2,884, as of 2:45 p.m. Eastern time. It waffled between a gain of 0.4 percent and a loss of that much earlier in the day. Slightly more stocks rose than fell on the New York Stock Exchange.

The Dow Jones industrial average inched up 10, less than 0.1 percent, to 26,497, and the Nasdaq composite rose 21 points, or 0.3 percent, to 7,757.

INTEREST RATES: The yield on the 10-year Treasury dipped to 3.21 percent from 3.22 late Friday.

Bond yields have been at center stage since last week, when their quick rise following several encouraging reports on the economy rattled markets. If rates go high enough, they can slow the economy and drive investors away from stocks and into bonds.

The 10-year yield was just 3.05 percent last Tuesday, and the speed of the recent rise has been more concerning to investors than the level. Rates are still relatively low, and the Federal Reserve’s main interest rate is less than half of what it was in 2006 before the Great Recession.

MATERIAL CONCERNS: PPG, which sells paints and coatings, sank 9.7 percent to $99.01 for the biggest loss in the S&P 500 after it warned that higher costs for oil and other materials will weigh on its third-quarter results. It also said that demand is weakening in China, as well as in the United States and Europe for automotive refinish products.

The profit warning helped send raw-material producers in the S&P 500 down 3.3 percent for the sharpest loss among the 11 sectors that make up the index.

BURST OF ENERGY: Energy stocks in the S&P 500 rose 1.4 percent for the largest gain in the index, aided by a rise in the price of crude oil. Pioneer Natural Resources rose 4.1 percent to $189.28, and National Oilwell Varco gained 3.4 percent to $45.86.

“We like energy right now, and we think prices aren’t likely to come down anytime soon,” said Barry James, president and portfolio manager of James Advantage Funds. “The explorers have been left behind a little bit by the refiners, and now’s their time to catch up.”

TECH RECOUPS: Technology stocks have been leading the market, both on the way up for most of the past year and on the way down over the last week. Technology companies are producing some of the biggest profit growth in the market, but their stocks are also trading at relatively high prices relative to those earnings. That makes them susceptible when worries are high that rising interest rates will hurt stocks with high price-earnings ratios.

Tech stocks in the S&P 500 are down 3.2 percent so far this month, roughly triple the loss for the overall index. But the group rose 0.2 percent Tuesday as interest rates dropped.

MARKETS ABROAD: Japan’s Nikkei 225 fell 1.3 percent, Hong Kong’s Hang Seng fell 0.1 percent and the Shanghai Composite index rose 0.2 percent.

In Europe, the CAC 40 in France rose 0.3 percent, and the German DAX gained 0.3 percent. The FTSE 100 in London edged up 0.1 percent.

IMF DOWNGRADE: The International Monetary Fund downgraded its forecast for global economic growth, citing higher interest rates and ongoing trade battles. The IMF said the global economy will grow 3.7 percent this year, the same as in 2017, but down from its earlier forecast of 3.9 percent. The IMF also cut its forecast for Chinese economic growth in 2019 to 6.2 percent, which would be its slowest since 1990.

COMMODITIES: Benchmark U.S. crude rose 0.9 percent to $74.94 a barrel. Brent crude, the international standard, rose 1.1 percent to $84.87 a barrel.

Gold rose 0.2 percent to settle at $1,191.50 per ounce, silver gained 0.5 percent to $14.40 per ounce and copper rose 1.4 percent to $2.81 per pound.

CURRENCIES: The dollar rose to 113.03 Japanese yen from 112.98 yen late Monday. The euro rose to $1.150 from $1.1488, and the British pound rose to $1.3147 from $1.3090.

———

AP Writer Annabelle Liang contributed from Singapore.