The conceptualist published a photograph of himself clutching a red Chinese passport on his Instagram account yesterday, with the words: "Today, I received a passport."
The 57-year-old added: "When I got it back I felt my heart was at peace." He added: "I think they should have given it back some time ago - and maybe after so many years they understand me better."
He could not say what had prompted the authorities to take the decision, but "now that they've let me go abroad, I believe they will let me return home". His first foreign trip will be to see his son, who lives in Berlin.
Ai designed the Bird's Nest stadium for the 2008 Beijing Olympics and filled Tate Modern's Turbine Hall with ceramic sunflower seeds for an exhibition.
A staunch critic of China's human rights records, works that will feature in his Royal Academy show include Remains (2015), consisting of porcelain replicas of bones discovered during an archaeological dig in Xinjiang province thought to be those of an unknown individual who died in a labour camp. Ai's father, a celebrated poet, was sent to one such camp with his family in the 1950s.
Tim Marlow, the artistic director of the RA, welcomed Beijing's decision. The academy recently launched a crowdfunding campaign to raise 100,000 towards the installation of Ai's tree sculpture in the courtyard outside the gallery.
His outspoken criticism of China's ruling Communist party has seen his work censored domestically.
But last month authorities allowed his first solo exhibition in the country to open in Beijing. It consisted of a reconstructed 400-year-old wooden ancestral hall.
The return of Ai's passport comes nearly two weeks after Beijing launched one of its most comprehensive crackdowns on civil society in decade.
At least 238 people were detained or questioned, according to the Hong Kong-based China Human Rights Lawyer Concern Group.
More than 20 are believed to be still under some form of detention, including the human rights lawyers Sui Muqing and Xie Yang, who are facing charges of "inciting subversion", which could see them jailed for up to 15 years.