The release was given on “humanitarian grounds”, Iranian state media report.
Homa Hoodfar, 65, was one of several dual nationals being held for alleged “acts against national security”.
She was ill and is being returned to Canada via Oman, the official Islamic Republic News Agency reported, citing the foreign ministry.
Mr Trudeau said the federal government had been “engaged at the highest levels” with her case.
“Canadians are relieved that Dr Hoodfar has been released from jail and will soon be reunited with her family, friends and colleagues,” he said.
Canada, which cut diplomatic ties with Iran in 2012, worked closely with officials from Oman, Italy and Switzerland to help secure the academic’s release.
Those Iranian authorities which assisted “understand that cases like these impede more productive relations,” Mr Trudeau said.
Read More- BBC
Image courtesy of AP