Shingon (真言宗 Shingon-shū) is a major Buddhist sect and a branch of Mahāyāna Buddhism, founded by the Japanese monk Kūkai (空海) at the beginning of the 9th century. It is also referred to as the Shingon-darani (Sanskrit: mantra-dharani) sect, or the Dainichi (Mahāvairocana) sect, and generally as mikkyō (密教, esoteric Buddhism). The basic doctrines and patterns of practice were established by Kūkai, who combined Indo-Chinese esoteric Buddhism by Madhyamika, Yogācāra, and Huayan or Flower Garland school of Buddhism (華厳宗 Kegon-shū) thought. No significant innovations in the teachings have been made since Kūkai; therefore, the essential tenets of Shingon Buddhism are found in the writings of Kūkai.

In the area of praxis - mantra recitation, mudrā (印相 inzō; Buddhist hand gestures), mandala drawing, the use of varieties of images for meditation, consecration rites (勧請 kanjō; Sanskrit: abhiṣeka) - many key elements of the Indian esoteric Buddhism which Kūkai found in Tang China (618-907 CE) are preserved. Consequently, among the major sects of Japanese Buddhism, the Shingon sect maintains the closest affinity with Hinduism and with the Lamaist Buddhism of Tibet and the Himalayan countries.

In contrast to the common belief that the Buddhist teachings are derived from the historical Shakyamuni Buddha, Shingon takes the stand that its fundamental sutras, the Mahāvairocana Sutra (大日経 Dainichikyō) and the Vajrasekhara Sutra (金剛頂経 Kongōchōgyō), were explicated by the Mahāvairocana Buddha (大日如来 Dainichi Nyorai), the Dharmakāya (Body of Dharma), the Ultimate Reality. Shakyamuni is interpreted as one of many manifestations of Mahāvairocana. According to Kūkai's Transmission of Dharma (付法傳 Fuhōden), Vajrasattva received the teachings directly from Mahāvairocana and sealed the sutras in an iron stupa in South India; 800 years after Shakyamuni's death, Nāgārjuna (龍樹菩薩 Ryūju-Bosatsu) opened the iron stupa and revealed the sutras to the world. Represented by these two sutras, esoteric Buddhism flourished in 7th-century India at Nālanda, the Buddhist university located near Bodh Gaya (in the Gaya District of the modern-day Indian state of Bihar).

Dharmagupta, the rector of the university, despatched the first missionary of Indian esoteric Buddhism, Śubhakarasiṃha (637-735 CE), who was nearly 80 at the time, to Tang China. Travelling by way of Central Asia, he arrived in the capital of Chang'an in 716. Well received by Emperor Xuanzong (685-762 CE) and by the court, Śubhakarasiṃha translated the Mahāvairocana Sutra from Sanskrit into Chinese, thereby laying the foundation of esoteric Buddhism in China. The second esoteric Buddhist master, Vajrabodhi (671-741 CE), also from Nālanda, arrived in Canton by the sea in 720 and translated the Vajrasekhara Sutra under the patronage of the imperial household. Amoghavajra (Chinese: Bùkōng, 705-774 CE) became the chosen disciple of Vajrabodhi. Well versed in Sanskrit and Chinese, Amoghavajra is regarded as one of the four great translators of Buddhist texts in China. The successor of Amoghavajra was the first native Chinese master of esoteric Buddhism, Hui-kuo (恵果 Keika, 746-805 CE), under whom Kūkai studied.

The interval between the transmission of esoteric Buddhism from India to China and its introduction from China to Japan was less than a century. Chinese esoteric Buddhism remained more or less in the stage of translation with little systematisation. The final task of systematising the teachings and practices of esoteric Buddhism fell upon Huiguo's disciple, Kūkai.

In the process of systematising the newly imported religion in Japan, Kūkai developed his ideas on the central questions of Buddhism: Who is the Buddha? What is enlightenment? And how can one attain it? He interpreted the Buddha as the Dharmakaya Mahāvairocana who revealed the Mahāvairocana and Vajrasekhara sutras. To achieve enlightenment meant to realise the "glorious mind, the most secret and sacred" (秘密荘厳心 Himitsu shōgon shin). He taught that man is intrinsically capable through the grace (加持 kaji) of Mahāvairocana and through his practice of yoga-samādhi of participating here and now in his present form, of becoming Mahāvairocana (即身成佛義 sokushin jōbutsu).

Kūkai's identification of Mahāvairocana with the Dharmakāya was unprecedented in Buddhism because until then the Dharmakāya had been regarded as formless, imageless, voiceless, and transcendent. By defining Mahāvairocana as the Dharmakāya, Kūkai identified Mahāvairocana with the eternal Dharma, the uncreated, imperishable, beginningless and endless Ultimate Reality. It is the realisation of this Dharma that made Gautama Siddharta the Enlightened One, that likewise makes all sentient beings endowed with intrinsic enlightenment into Buddhas. The sun is the source of light and warmth, the source of life. Similarly, Mahāvairocana is the Great Luminous One at the centre of the esoteric Buddhist mandala, surrounded by a profusion of Buddhas, bodhisattvas, and spirits; he is the source of enlightenment and the unity underlying all varieties of existence in the universe.

To attain enlightenment means to realise Mahāvairocana, the implication being that Mahāvairocana is initially within man himself. Hence, Kūkai called Mahāvairocana the "enlightened mind" (Sanskrit: bodhicitta), a synonym for Suchness, or the element of "original enlightenment" (本覚 hongaku) within all sentient beings. Speaking of this immanence of the Dharmakāya, Kūkai says: "Where is the Dharmakāya? It is not far away; it is in our body. The source of wisdom? In our mind; indeed, it is close to us." The motto of the Shingon sect is, "attaining enlightenment in this very existence."

From the theme of attaining enlightenment in this very existence, Kūkai developed the idea of the "preaching of the Dharmakāya" (法身説法 hosshin seppō). He insisted that esoteric Buddhism had been preached by the Dharmakāya Mahāvairocana, while all other Buddhist teachings were preached by the Nirmanakaya Buddha Sakya-muni, a temporal incarnation of the timeless Dharmakāya Mahāvairocana. At first, Kūkai employed the word "preaching" in its traditional usage in the Buddhist canon; but as the years went by, he came to interpret Dharmakāya preaching in a more fully symbolic sense.

Kūkai speculated on the nature and value of the mantra (真言 Shingon), the shortest verbal form of the "preaching of the Dharma-kaya". He reasoned that the sutras of esoteric Buddhism, such as the Mahāvairocana and the Vajrasekhara sutras, are records of the preaching of the Dharmakāya Buddha and exist because of his compassion and wisdom. Therefore, the mantras, conveying the essential meaning of these sutras, are filled with the preacher's spirit, compassion, knowledge, and saving power.

Linking the nature and value of the mantra to the preaching of the Dharmakāya Buddha, Kūkai extended the meaning of "preaching" to include all phenomena, interpreting the word as the acts of communication of the Dharmakāya Mahāvairocana. Oral preaching is only one means of communication; non-oral preaching may also be pursued using silence, gesture (Sanskrit: mudra), colour, or form. Kūkai's concept culminated in his work, The Meanings of Sound, Word, and Reality (聲字實相義 Shoji jisso gi), in which he asserted that the Dharmakāya Mahāvairocana is reality (實相 jisso) and that he reveals himself through all objects of sense and thought. In other words, all things in the universe reveal the presence of Mahāvairocana. All phenomena point to the underlying reality, Mahāvairocana, and at the same time are the expressions of that Reality.

In attaining enlightenment in this very existence (即身成佛義 Sokushin jōbutsu gi), Kūkai explains his conception of Mahāvairocana as the Body of Six Great Elements, consisting of the three constituents: the Six Great Elements (六大縁起論 rokudai engi), the Four Mandalas, and the Three Mysteries (三密 sanmitsu). These three correspond respectively to the essence (體 tai), the attributes (相 sō), and the functions (用 ) of the Dharmakāya Mahāvairocana. The Six Great Elements are earth, water, fire, wind, space, and consciousness. The adjective "great" signifies the universality of each element. The first five stand for all material elements and the last, for the spiritual aspect; that is, the body and the mind of Mahāvairocana. These Six Great Elements create all Buddhas, all sentient beings, and all material worlds. There is no creator other than the Six Great Elements, which are at once the creating and the created. Mahāvairocana, consisting of the Six Great Elements and abiding in a state of cosmic harmony, is one without a second and the totality of all existences and activities in the universe. Thus, all the diverse manifestations of the phenomenal world are identical in their constituents; all are in a state of constant transformation; no absolute difference exists between man and nature; body and mind are non-dual.

The Four Mandalas (four types of the mandala) are the mahā-maṇḍala (大曼茶羅 dai-mandara), samaya-maṇḍala (三昧耶曼茶羅 samaya-mandara), dharma-maṇḍala (法曼茶羅 ho-mandara), and karma-maṇḍala (羯磨曼茶羅 katsuma-mandara). These represent Mahāvairocana seen from four different perspectives. The mahā-maṇḍala is the great (mahā) circle, the universe, Mahāvairocana seen in his physical extension. The samaya-maṇḍala is the same circle seen from the viewpoint of the omnipresence of Mahāvairocana's "intention" (samaya). The dharma-maṇḍala is the same circle viewed as the sphere where the revelation of the truth (dharma) takes place, namely, Mahāvairocana's field of communication. Finally, the karma-maṇḍala is the same circle seen from the viewpoint of his action (karma). The Four Mandalas stand for Mahāvairocana's extension, intention, communication, and action. His extension is the totality of the five great elements; his intention is affinity, love and compassion; his communication is the revelation of himself as the "preaching of the Dharmakāya"; and his action, all activities in the universe.

The Three Mysteries are the suprarational activities of the body, speech, and mind of Mahāvairocana. The mystery of the activities of the body is manifested universally through the forms or patterns of phenomena; the mystery of the activities of the mind, through aesthetic and ecstatic experiences of yoga-samādhi. Kūkai interprets the Three Mysteries as the expression of the compassion of Mahāvairocana toward sentient beings. He holds that faith comes through the grace (加持 kaji) of the Buddha: it is not acquired by the individual but given. Because of Kūkai's emphasis on the mercy of the Three Mysteries, the Shingon sect has also been called the religion of the "Three Mysteries and Grace" (三密加持 sanmitsu kaji).

The fundamental principle of the practice of Shingon meditation is to integrate the microcosmic activities of body, speech, and mind of the individual existence into the macrocosmic activities of body, speech, and mind, the contents of the yoga-samādhi of Mahāvairocana. This is done through symbolic acts of the body (the pose of sitting in meditation and the use of hand gestures, mudrā); of speech (the recitation of mantras, the symbols of the essence of speech of Mahāvairocana); and of mind (practices involving thinking, feeling, imagining, visualizing, listening, and of ceasing the activities of the mind). This is called the practice of "entering self into self so that the self enters into self" (入我我入 nyūga ganyū).

There are many different methods of meditation, just as there are many manifestations of Mahāvairocana shown in the paintings of the Diamond Realm (金剛界曼荼羅 Kongōkai; Skt. Vajradhātu) and Womb Realm (胎蔵界曼荼羅 Taizōkai; Skt. Garbhadhātu) mandalas. Among these methods are the meditations on the Diamond Realm, on the Womb Realm, on the Moon (symbol of enlightened mind), on the letter A (Mahāvairocana), and on Acala (不動 fudō). All can be regarded as the practice of the samādhi of Mahāvairocana since the object invoked in each meditation is a manifestation of Mahāvairocana. Some are extremely simple, consisting of only a single mantra and one mudrā. Thus, despite the complexity of its teachings and its somewhat secretive approach, its readily accessible practice of mantra recitation and the popularity of its founder Kūkai have earned Shingon Buddhism supporters from all walks of life.

The Sanskrit title Mahāvairocana (大日 Dainichi) means "Great Sun." The great sun goddess (Amaterasu-ōmikami) is the central figure in the Shinto pantheon, and this analogue had curious implications in the relationship between esoteric Buddhism and Shinto. With the development of ryōbu shintō (両部神道 “Dual Aspect Shintō”) in the medieval period, Amaterasu came to be widely recognised as an avatar of Dainichi. Esoteric Buddhism - developed in India and embracing a plethora of native Hindu deities - provided the ground for the fusion of Buddhism and Shinto. Shingon Buddhism was, in fact, instrumental in forming shugendō (修験道), supplying its theories and patterns of practice. Even today, the headquarters of Shugendō (Tōzan branch) is a Shingon temple, Daigo-ji (醍醐寺) in Kyōto.

There are two major divisions in the Shingon sect: Old Shingon (古儀真言宗 Kogi Shingon-shū) and New Shingon (新義真言宗 Shingi Shingon-shū). Toward the end of the Heian Period, Kakuban (覚鑁/覺鑁; 1095–1143), an ardent follower of Kūkai, established on Mt. Koya (高野山 Kōyasan) an institute for the transmission of dharma called Dembō-in, which came into conflict with the mountain's Shingon headquarters, the Kongōbu-ji (金剛峯寺). One hundred and forty years later, the doctrine of the "preaching of the Dharmakāya" led Raiyu (頼瑜, 1226-1304), a descendant in Kakuban's line, to advocate a new theory which held that the esoteric Buddhist sutras were preached by the Body of Grace of Mahāvairocana (kajishin seppō). A fierce controversy broke out, with the traditionalists maintaining that these sutras were taught by the Body of Mahāvairocana's Intrinsic State (本地身説法 honjishin seppō). Raiyu left Mt. Koya and established the temple Negoro-ji (根来寺), the headquarters of the New Shingon, about 25 kilometres northwest of Mt. Koya.

Following the destruction of the Negoro-ji by Toyotomi Hideyoshi in 1585, two new centres were created by the followers of Kakuban: one at Hasedera temple (長谷寺), also called Chokoku-ji (Buzan branch) in Nara Prefecture, and another at the Chishakuin (智積院, Chizan branch) in Higashiyama-ku, Kyōto. The Old Shingon sect includes the following subsects: the Tō-ji (東寺), the Daigo-ji (醍醐寺), the Daikaku-ji (大覚寺), the Ninna-ji (仁和寺), the Sennyū-ji (泉涌寺), the Kajū-ji (勧修寺), the headquarters of the Yamashina branch, all in Kyōto, and the Zentsuji subsects at the Byōbuura Gogakusan Tanjō-in Zentsū-ji (屏風浦五岳山誕生院善通寺) in Kagawa Prefecture.