Luxembourg has sworn in its first openly gay prime minister, Xavier Bettel, paving the way for reforms on same-sex marriage in the country.

Bettel replaced Jean-Claude Junker on Wednesday who was, until then, the European Union's (EU) longest-serving head of government. Bettel's deputy, Etienne Schneider, is also openly gay.

The new leader, previously the mayor of Luxembourg City, is expected to introduce changes like replacing religious instruction in school with more general ethics classes.

He said his government will need to take unpopular measures and must cut spending to preserve its triple-A credit rating.

Luxembourg is one of the world's smallest countries, with just over half a million people. But it is a major financial centre, second only to the US for investment funds, and a leading private banking hub.