The pañcākṣara mantra (literally “five-lettered mantra”) is “oṃ namaḥ śivāya” ( ॐ नमः शिवाय ), the five letters being “na”, “ma”, “śi”, “va”, and “ya”.
This stotram describes each of those syllables as a representation of Lord Śiva. The five verses of the stotram begin with each of the five letters, in order.
नागेन्द्रहाराय त्रिलोचनाय भस्माङ्ग-रागाय महेश्वराय
नित्याय शुद्धाय दिगम्बराय तस्मै नकाराय नमः शिवाय ॥ १ ॥
nāgendrahārāya trilocanāya bhasmāṅga-rāgāya maheśvarāya
nityāya śuddhāya digambarāya tasmai nakārāya namaḥ śivāya ॥ 1 ॥
O Great Lord, wearing the king of serpents as a garland, the Three-Eyed One, whose body is smeared with sacred ash, eternal and pure, clothed only in the four directions of space. I bow to Lord Śiva, represented by the syllable “na”.
मन्दारपुष्पबहुपुष्पसुपूजिताय तस्मै मकाराय नमः शिवाय ॥ २ ॥
mandāra-puṣpa-bahu-puṣpa-supūjitāya tasmai makārāya namaḥ śivāya ॥ 2 ॥
O Great Lord, worshipped with water from the Mandākini river and smeared with sandal paste, the Lord of Nandi and master of ghosts and goblins, worshipped with countless varieties of flowers including those of the sacred mandāra tree. I bow to Lord Śiva, represented by the syllable “ma”.
शिवाय गौरीवदनाब्जवृन्दसूर्याय दक्षाध्वरनाशकाय
श्रीनीलकण्ठाय वृषध्वजाय तस्मै शिकाराय नमः शिवाय ॥ ३ ॥
śivāya gaurī-vadanābja-vṛnda-sūryāya dakṣā-dhvara-nāśakāya
śrī-nīlakaṇṭhāya vṛṣa-dhvajāya tasmai śikārāya namaḥ śivāya ॥ 3 ॥
The auspicious one, who is the sun that causes The Radiant Goddess’s face to blossom like a lotus, the destroyer of Dakṣa’s sacrificial fire1, whose throat was made blue by drinking poison to save the world, and whose symbol is a bull. I bow to Lord Śiva, represented by the syllable “śi”.
चन्द्रार्कवैश्वानरलोचनाय तस्मै वकाराय नमः शिवाय ॥ ४ ॥
candrārka-vaiśvānara-locanāya tasmai vakārāya namaḥ śivāya ॥ 4 ॥
Venerable sages like Vasiṣṭha, Agastya (Kumbodbhava), and Gautama, as well as Indra and the other gods, have worshipped the crown of Your head (the Śivaliṅga). Your three eyes are Candra (the moon), Sūryā (the sun), and Agni (the divine fire). I bow to Lord Śiva, represented by the syllable “va”.
यक्षस्वरूपाय जटाधराय पिनाकहस्ताय सनातनाय
दिव्याय देवाय दिगम्बराय तस्मै यकाराय नमः शिवाय ॥ ५ ॥
yakṣa-svarūpāya jaṭā-dharāya pināka-hastāya sanātanāya
divyāya devāya digambarāya tasmai yakārāya namaḥ śivāya ॥ 5 ॥
O Eternal One, You are the very embodiment of sacrificial worship, with matted locks of hair, holding the great bow Pināka, divine, radiant, and clothed only in the four directions. I bow to Lord Śiva, represented by the syllable “ya”.
पंचाक्षरमिदं पुण्यं यः पठेच्छिवसन्निधौ
शिवलोकमवाप्नोति शिवेन सह मोदते
paṃcākṣaramidaṃ puṇyaṃ yaḥ paṭhecchivasannidhau
śivalokamavāpnoti śivena saha modate
Whoever faithfully recites the pañcākṣara mantra (oṃ namaḥ śivāya) is in the presence of Śiva Himself, and will attain the abode of Śiva and will rejoice with Him.
इति श्रीमच्छंकराचार्यविरचित शिवपञ्चाक्षर स्तोत्रं समाप्तं
iti śrīmacchaṃkarācāryaviracita śivapañcākṣara stotraṃ samāptaṃ
Thus ends the Ode to the Five-Lettered Śiva Mantra composed by Ādi Śaṅkarācārya.
Prajāpati Dakṣa was the father of Sati and father-in-law to Lord Śiva. Dakṣa was unable to perceive that Śiva was in fact mahādeva (the greatest of all divine beings), and mistook him for an uncultured mendicant, unfit to marry the daughter of a king. Śiva is a renunciant yogi, and therefore is not bound by the rules of conduct laid out in the vedas, and because he didn’t follow the vedas, Dakṣa held him to be impure and unholy. But Sati (who was herself an incarnation of Ādi Parāśakti, the supreme goddess) chose Śiva to be her husband, and left the comforts of her father’s kingdom to live with her new husband at Mount Kailāsa. Dakṣa, who already disliked Śiva, was enraged at his daughter’s perceived slight.
Some time later, Dakṣa organized a great yajña ritual (a sacrificial fire ceremony) and invited all the gods, goddesses, kings, and princes. He did not invite Sati or Śiva. Sati rationalized that she had not been invited because she needed no invitation to visit her family, and decided to attend anyway, despite Śiva’s warnings not to go. She was received very coldly by her father, who insulted her and her husband in front of the assembled guests. Unable to bear her father’s insults and overcome with loathing for his ignorance, Sati threw herself onto the sacrificial fire. As her body burned she revealed her true form as Ādi Parāśakti and castigated her father for his foolish arrogance. Just before she died, she prayed that she would be reborn to a father whom she could respect.
Śiva — sensing his beloved’s demise and overcome with anguish — peformed the fearsome tāṇḍava nṛtya, the dance that dissolves creation. He unleashed his anger upon the yajña, killing most of the attendees and decapitating Dakṣa.
Once his rage was pacified, Śiva restored the life of all whom he killed, including his father-in-law. He replaced Dakṣa’s head with that of a goat as a lesson in humility. Dakṣa was thereafter an ardent devotee of Śiva.
Sati was reborn as the daughter of King Himavat, the personification of the Himālayas. She was called Pārvatī (meaning “daughter of the mountain”), and married Śiva again. ↩