As terms of the country’s exit from the European Union are mapped out, Britain’s future is murky. Yet the foundation of its business climate remains attractive, leading the U.K. to the top spot in Forbes’ 13th annual look at the Best Countries for Business, which measures countries that are most hospitable to capital investment. It is the second straight year with the U.K. in the lead.

The U.K. is the only country to land among the top 30 (out of 161 countries ranked) on 15 metrics used for research to rate the countries.

15 different factors have been considered , including property rights, innovation, taxes, technology, corruption, freedom (personal, trade and monetary), red tape and investor protection. Other metrics included were workforce, infrastructure, market size, quality of life and risk. Each category was equally weighted.

The data is based on published reports from Freedom House, Heritage Foundation, Property Rights Alliance, United Nations, Transparency International, World Bank Group, Marsh & McLennan and World Economic Forum.

Sweden moves up two places to finish second this year. The business climate of the export-oriented economy received high marks for innovation, property rights, risk and low corruption. Stockholm is one of Europe’s leading tech startup hubs. The ratio of national debt to GDP in the Scandinavian country has dropped from 80% in 1995 to 41% last year.

Rounding out the top five countries overall are Hong Kong, Netherlands and New Zealand.

The U.S. fell five spots this year to 17th, a tick ahead of Spain. The world’s biggest economy at $19.5 trillion lost ground on personal, trade and monetary freedoms.

African nations populate the worst countries for business with seven of the bottom 10 (Haiti is the weakest among non-African countries). These countries typically fare poorly on innovation, trade freedom and investor protection. The Central African Republic ranks last. The conflict-prone nation has a GDP per capita of only $400.