Confidence among small-business owners in the U.S. flatlined in May for a second consecutive month, but expectations for future business conditions continued to deteriorate amid persisting inflation and supply shortages.

The NFIB Small Business Optimism Index decreased marginally to 93.1 in May from 93.2 in April, the lowest level since April 2020, according to data released Tuesday by the National Federation of Independent Business. The reading is broadly in line with economists’ expectations in a poll by The Wall Street Journal.

“Small-business owners remain very pessimistic about the second half of the year as supply-chain disruptions, inflation and the labor shortage are not easing,” NFIB Chief Economist Bill Dunkelberg said.

The number of small-business owners who expect better business conditions in the next six months declined further in May, reaching a fresh new low in the near-five-decade survey’s history.

Respondents also became more downbeat when assessing their projections for short-term sales.

The NFIB survey is a monthly snapshot of small businesses in the U.S., which account for nearly half of private sector jobs. Economists look to the report for a read on domestic demand and to extrapolate hiring and wage trends in the broader economy.

Earning trends deteriorated over the month, with respondents reporting higher labor and raw materials costs, the report said.

The number of respondents who plan capital outlays decreased slightly over the month.

Plans to increase employment increased markedly, but small firms continued to struggle to fill open positions in a tight labor market. Around 51% of respondents reported job openings they could not fill, up four points from April, the NFIB said.

Inflation pressures broadened, according to the survey. The percentage of owners raising average selling prices increased two points to 72%, back to the highest reading in the 48-year-history of the survey last reached in March.

“Inflation continues to outpace compensation which has reduced real incomes across the nation,” Mr. Dunkelberg said. Price growth remained the most important problem for business owners, the report said.

Supply-chain bottlenecks didn’t show signs of easing, according to the survey. Almost 40% of owners reported that supply-chain disruptions have had a significant impact on their business, up three points compared with April.

Write to Xavier Fontdegloria at xavier.fontdegloria@wsj.com