The numbers: Consumer confidence surged in May to a six-month high, spurred by a strong labor market, a new survey showed. Higher gas prices and a flare-up in trade tensions with China appeared to do little to dampen the optimism of Americans.

The consumer confidence index climbed to 134.1 from 129.2 in April, the Conference Board said Tuesday.

One caveat: The survey results were mostly compiled before trade talks between the U.S. and China suffered a big setback.

What happened: A separate survey that asks Americans how they view the economy in the present rose to a 18-and-a-half-year high of 175.2. The last time the index was higher was in December 2000.

Another index that tracks how consumers expect the economy to behave six months from now rose to 106.6 from 102.7. The post-recession peak is 115.1, which was set last October.

Big picture: The U.S. labor market has shown remarkable resilience in the past year, with companies continuing to add jobs despite somewhat slower growth at home and abroad.

A robust jobs market is likely to fuel more consumer spending and keep the economy expanding at a steady clip, but lingering trade tensions will continue to act as a restraint on growth./

Read:‘Whiff of U.S. recession’? It’s in the air again, but strong labor market the antidote

What they are saying? “Consumers expect the economy to continue growing at a solid pace in the short-term,” said Lynn Franco, director of economic indicators at board, “And despite weak retail sales in April, these high levels of confidence suggest no significant pullback in consumer spending in the months ahead.”

Read:Good news for home buyers: Prices rising at slowest pace in seven years

Market reaction: The Dow Jones Industrial Average DJIA, +0.19% and S&P 500 SPX, +0.29% fell almost 1% in Tuesday trades, giving up early gains later in the session.