Ravana was obsessed with his powers and was egoistic, and to display and prove his powers he was about to move Mount Kailash (the abode of Shiva who was his ancestor god). He managed to lift the mountain but Shiva immediately placed it back just by pressing his toe crushing Ravana's fingers in the process. That is when Ravana sings "Tandav Stotra" and he was spared and blessed with chandrahas (moon sword by Lord Shiva) considered one of the most powerful weapons in Hindu Mythology.