The Vajrasekhara Sutra is an important Buddhist Tantra used in The Vajrayana Schools of Buddhism, but can refer to a number of different works. In particular a cycle of 18 texts studied by Amoghavajra, which included both Sarvatathāgatatattvasaṃgraha Tantra and the Guhyasamaja Tantra, a Tibetan text which appears to be composed of two works grouped together and to further confuse matters in the Japanese Shingon school the Sarvatathāgatatattvasaṃgraha Tantra is known by this name. In Tibetan it is considered to be the main representative of the Yoga Tantra class of texts.
The Sutra begins with Mahavairocana Buddha preaching the Dharma to a great host of Bodhisattvas, including Vajrasattva, in the Buddhist Heaven of Akanishta. As he preaches the Dharma, Prince Sarvarthasiddhi, the esoteric name of The Buddha, Siddhartha Gautama, is meditating under the Bodhi tree. Enlightenment is imminent, but the Prince has still not attained it because he is still attached in some small way to his forsaken ascetic practices. Despairing over his inability to find Enlightenment, he is visited by Buddhist figures who were just now learning the Dharma from Mahavairocana.
These same deities proceed to teach him a more direct path to Enlightenment through esoteric Ritual. The Sutra then details the Rituals used to actualize the Dharma. These Rituals help forming the basis of esoteric Ritual in Shingon Buddhism, including such practices as meditating upon the full moon and the use of certain mantras.
This Sutra also introduces the Diamond Realm Mandala as a focus for Meditative practices, and its use in the abhiseka Ritual of initiation. As the prince has now experienced Enlightenment, he ascends to Mount Sumeru and constructs the Diamond Realm Mandala and initiates and converts the bodhisattvas gathered there, one by one, into esoteric deities who constitute the Mandala.
In esoteric Ritual, the teacher of the Esoteric Buddhism assumes the role of the Prince who constructs the Mandala, while the master and student repeat specific mantras in a Form of dialogue. The student, who is blindfolded, then throws a flower upon the Mandala that is constructed, and where it lands (i.e. which deity) helps dictate where the student should focus his devotion on the esoteric path. From there, the student's blindfold is removed and a Vajra is placed in hand.