The S&P 500 closed out 2023 with a gain of more than 24 per cent and the Dow finished near a record high, as easing inflation, a resilient economy and the prospect of lower interest rates buoyed investors, particularly in the last two months of the year.