US consumer confidence unexpectedly rose in May for the first time in four months as views about business conditions and the labor market were less negative.

The Conference Board’s gauge of sentiment increased to 102 from an upwardly revised 97.5 in April, according to data out Tuesday. The reading beat all estimates in a Bloomberg survey of economists.

May’s index of present conditions climbed for the first time since January and the measure of expectations jumped by the most since July.

Despite the increase, confidence has trended lower in recent months as inflation has remained mostly stubborn, household debt hit a record and the job market has softened. And with the Federal Reserve keeping interest rates at a two-decade high, voters are generally downbeat on the economy ahead of November’s election.

That was especially illustrated in Tuesday’s report as consumers’ perceived likelihood of a recession in the next year rose for a second consecutive month.

This article was provided by Bloomberg News.