The United States has freed an Iranian man from jail in exchange for the release of a US national by Iran.

US President Donald Trump said in a statement on Saturday that a Chinese-American researcher convicted of spying in Iran has been freed after being detained in the country since 2016.

Trump said that freeing Americans held captive is of vital importance to his administration.

He thanked Iran on Twitter for what he described as "a very fair negotiation." He added, "See, we can make a deal together."

A senior US government official said that the freed Iranian researcher was arrested in the US last year for allegedly trying to transport banned material out of the US, breaching the US sanctions on Iran.

US media say the prisoner swap was carried out in Switzerland.

Our correspondent in Washington says despite the successful prisoner swap, it is not certain that relations between the US and Iran will improve in light of Iran's strong distrust of Washington.