Mr Raisi, a hardline cleric, succeeds Hassan Rouhani, seen in the West as a relative moderate.
It comes at a time of growing challenges for Iran, whose economy has been crippled by US-led sanctions.
There are also heightened tensions with foreign powers who have blamed Iran for a deadly drone attack on a tanker near Oman last week, which Iran has denied.
Two people - British and Romanian security guards - were killed when the MV Mercer Street, operated by an Israeli-owned company, was struck. Britain, the US and Israel accused Iran of carrying it out.