Iran has declared Jerusalem the "unchangeable" capital of Palestine and has vowed to confront any attempt to change its status.

Speaking in Tehran on Wednesday, Deputy Foreign Minister Abbas Araqchi said the city would remain the Palestinian capital forever, Iran's Fars News Agency reported.

"Jerusalem is the unchangeable capital of the Muslim world and of Palestine," Araqchi said, adding Iran will "confront any attempt to change this reality".

The comments came nearly two months after US President Donald Trump announced the US was moving its embassy from the Israeli city of Tel Aviv to Jerusalem, following through on a long-held pledge to recognise the city as Israel's capital.

Though previous US leaders, including former presidents Barack Obama, George W Bush, and Bill Clinton, had spoken of doing the same during their tenures, Trump was the first to actually make the move.

The decision has attracted strong criticism from Muslim states, including opponents of the US, such as Iran, but also its traditional allies, such as Turkey.

Araqchi was voicing sentiments widely expressed by Iranian leaders, most notably by Iran's Supreme Leader Ayatollah Ali Khamenei.

In a speech published on his website on Tuesday, Khamenei said all Muslims had a duty to oppose Israeli and US attempts to wrestle Jerusalem from the Palestinians.

"We must by no means think that it is too late, even if decades have passed," he said.

Jerusalem is a city considered holy by Muslim, Christian, and Jewish believers. It was divided between Israeli and Arab forces after the latter's defeat to the former during the 1948 Arab-Israeli War.

Israel took over the eastern part of the city in the 1967 Six-Day War, and has occupied the territory since annexing it unilaterally in 1980, prompting international rejection and condemnation.

The state has solidified its hold on the occupied territory by building settlements both within East Jerusalem and in bordering areas in the occupied West Bank.