Strong gains by Goldman Sachs, Caterpillar and Chevron sent Dow to the record. Energy and materials continued this week's momentum, leading gains among S&P 500 sectors. Defensive utilities and real estate led sectoral declines.

"Energy, financial, materials, industrials are all outperforming. They tend to be cyclically oriented sectors and tend to benefit during periods when the economies are reopening and expanding," said Terry Sandven, chief equity strategist at U.S. Bank Wealth Management.

Strong economic data and earnings pushed the S&P 500 and Nasdaq indexes to record high last week, but markets have wobbled amid concerns about rising inflation and potentially higher U.S. interest rates.

"Once you have markets hitting the highs we have seen recently, the one thing investors are worried about is rising inflation and what that means for profitability of companies," said Shawn Cruz, senior market strategist at TD Ameritrade.

The Dow closed at 34,230.34, up by 0.29%, while the S&P 500 gained 2.93 points, or 0.07%, to 4,167.59.

The Nasdaq Composite gave up its earlier gains and ended 51.08 points, or 0.37%, lower at 13,582.43.

Megacap technology companies including Amazon.com Inc and Facebook Inc and Alphabet Inc were down over 1%. The Philadelphia SE Semiconductor index recovered from a sell-off on Tuesday by rising 0.61%.

Investors sold off tech on Tuesday after Treasury Secretary Janet Yellen suggested that interest rates might need to rise in an overheating economy.

She later clarified that a near-term interest rate hike was not something she was "predicting or recommending" on Tuesday evening.

The ADP National Employment Report showed U.S. private payrolls increased in April as companies rushed to boost production amid a surge in demand, powered by massive government aid and rising vaccinations against COVID-19.

A more comprehensive reading in the form of the Labor Department's non-farm payrolls data is due on Friday.

The largest percentage gainer on the S&P 500 was Caesars Entertainment Inc , which rose 7.8% after the casino operator said it expected to benefit from the economy reopening.

On the Nasdaq 100, the largest gainer was T-Mobile US Inc, which rose 4.4% after it raised full-year postpaid subscriber net additions forecast..

Peloton Interactive Inc plunged by 14.6%, hitting an eight-month low on its announcement to recall its treadmills amid reports of multiple injuries and the death of a child in an accident.

Uber Technologies Inc's shares fell over 4% during afterhours trading after reporting a narrower first quarter loss amid strong growth in its food-delivery business, while ride-hailing bookings were flat.

Volume on U.S. exchanges was 8.35 billion shares, compared with the 9.94 billion average for the full session over the last 20 trading days.

(Reporting by Shreyashi Sanyal and Sruthi Shankar in Bengaluru, Krystal Hu in New York Editing by Marguerita Choy and Arun Koyyur)

By Krystal Hu and Shreyashi Sanyal