The U.S. is back on top as the most competitive country in the world, regaining the No. 1 spot for the first time since 2008 in an index produced by the World Economic Forum, which said the country could still do better on social issues.

America climbed one place in the rankings of 140 countries, with the top five rounded out by Singapore, Germany, Switzerland and Japan. All five countries’ scores rose from 2017, with the U.S. notching the second-biggest gain after Japan’s.

The...