Gabriel de Magalhães (Chinese: 安文思; pinyin: Ānwénsī; 1610 – 6 May 1677), or gallicized as Gabriel Magaillans, was an early Portuguese Jesuit missionary to China who was one of the first Catholic missionaries to reach Sichuan and founded the original St. Joseph's Church in Peking.
 Magalhães was born in Pedrógão, Coimbra, Portugal, a member of the same family as Ferdinand Magellan.
 After first spending six years in the Portuguese colony of Goa, Magalhães arrived in Hangzhou in 1640.: 248   He was then sent to Chengdu in Sichuan and arrived in August 1642. He began a close association with fellow Jesuit Lodovico Buglio in Chengdu, and started to study Chinese under Buglio's guidance.  Buglio would become his biographer 35 years later.
 Both Magalhães and Buglio were pressed to serve under the rebel "King of the West", Zhang Xianzhong (Wade–Giles: Chang Hsien-chung) after Zhang captured Sichuan in 1644. Initially Magalhães wrote sympathetically of Zhang's attempts at empire-building in Chengdu, but became fearful when Zhang started his campaign of terror in Sichuan.: 16 
 After Zhang was defeated by the Manchus in 1647, the pair was captured by Hooge.  In his plea to avoid execution, Magalhães claimed the German Jesuit Adam Schall as their "elder brother" who was recognized by the Manchu commander. They were taken to the Forbidden City in Peking in 1648 where they were well received by the Shunzhi emperor, and were given a church, house and income.: 124  He and Buglio undertook the construction of the original St. Joseph’s Church in Peking (originally known as Dong Tang or Eastern Church). Magalhães was given the duty of maintaining various Western machinery, including the clocks at the court of the Shunzhi and Kangxi emperors. He built a number of mechanical devices, including a carillon and turret clock that played a Chinese tune on the hour.
 After the death of the Shunzhi emperor, anti-Christian sentiments surfaced, and in 1661, during the reign of the Kangxi emperor, Magalhães was charged with bribery. He was imprisoned and tortured, but later released as the charges were not sustained.
 Magalhães died in Peking on 6 May 1677 and the Kangxi emperor himself wrote Magalhães' eulogy, and granted his estate 200 taels of silver and ten large bolts of silk.: 101–2  He was buried in the Jesuits' Zhalan Cemetery in Beijing. 
 Starting in 1650, Magalhães began writing "the most comprehensive and perceptive description of China" in the second half of the 17th century, and it was completed in 1668. After Magalhães' death, the work was taken to Europe by the French Jesuit Philippe Couplet in 1681, and was translated by Abbé Claude Bernou. It was published under the title Nouvelle Relation de la Chine, contenant la description des particularitez les plus considerables de ce grand empire in 1688.  The work was originally written in Portuguese as Doze excellencias da China (Twelve excellences of China) and deals with various aspects of China, such as its history, language, custom, and government. Part of the document however was damaged by fire, and there were therefore alterations and deletions in the translation. The translation was reorganized into 21 chapters instead of the original 12, and was published under its new French title with the author's name gallicized as Gabriel de Magaillans. It was also translated into English the same year as A New History of China Containing a Description of the Most Considerable Particulars of that Vast Empire.
 Magalhães also left works in Chinese – including the translation of De resurrectione carnis (復活論), which is part of the supplement to pars tertia of Thomas Aquinas' Summa Theologica (超性學要) previously partly translated into Chinese by Buglio.
 Magalhães and his fellow missionaries left a positive impression on the Kangxi emperor who described them as "devoted to the public good."  He went on:
 "They have done nothing wrong, yet many Chinese have mistrusted them.  However, We have always known that they are sincere and trustworthy.  We have for many years carefully observed their behaviour and found that they have done absolutely nothing improper.": 82  This recognition by the emperor laid the foundation for the edict of toleration of 1692.: 83