Khan, 47, popularly known as "King Khan", was cheered at the square -- a mecca of tourism in Morocco -- where a giant screen was installed to show a preview of his latest Hindi movie, "Jab Tak Hain Jaan" (Till My Last Breath).
In its 12th edition, the festival which runs until December 8 in this ochre city, is presenting a "special tribute" to Indian cinema as it celebrates its centenary.
"I am pleased to present the star, the icon, the demigod of Indian cinema, Shah Rukh Khan," said an organiser as the arrival of the star sparked a roar from young fans, who braved gloomy and cold weather to catch a glimpse of him.
Khan, who acted in some 80 films, was specially invited for the festival in Morocco, where Bollywood films rank alongside Egyptian movies in popularity.
A true showman, he warmed up the atmosphere with more than half-an-hour song and dance performance on stage that had the crowds screaming in appreciation.
Later festival organisers screened a preview of "Jab Tak Hain Jaan," directed by legendary Bollywood filmmaker Yash Chopra who died in October in Mumbai, the home of India's Hindi-language movie industry, after more than five decades of movie career.
Khan had acted in several box-office hit movies produced and directed by Chopra such as "Dilwale Dulhaniya Le Jayenge" (Bravehearts Will Take The Bride Away), "Dil To Paagal Hai" (Heart Is Crazy) and "Daar" (Fear).
He has also taken lead roles in other blockbusters such as "Kuch Kuch Hota Hai" (Something Is Happening) and "Kabhie Khushi Kabhie Gham" (Sometimes Joy, Sometimes Sorrow) directed by another popular Bollywood filmmaker Karan Johar.