Prior to this, the privilege was only that of the Nepal royals of the then ruling Shah dynasty.
Modi offered Rs.27,000 to cover the cost of the entire function, including the "Rudra Abhishekam" puja, on the auspicious third Monday of the month of Shravan in the Hindu calendar.
For Basuki Puja, Modi offered Rs.5,100 more.
Walking barefoot and dressed in saffron, Modi spent around 45 minutes inside the temple here on the banks of the Bagmati river.
According to Govinda Tandon, member secretary of the Pashupatinath Area Development Trust (PADT), only the reigning monarch of the now overthrown Shah dynasty was permitted to worship the rare silver-covered Shiva Lingam sitting alongside it in the sanctum santorum.
Commoners are allowed to venerate the Shiva Lingam only from outside the door of sanctum santorum.
"We provided the same privilege to Modiji that former royals were granted. Because of his affection and dedication for the temple, we decided to provide him this special privilege," Tandon said.
The decision to allow Modi to worship the Shiva Lingam of Pashupatinath was taken at the highest political level, IANS has learnt. Only the ruling kings of Nepal could perform the special puja in this manner.
The mattress on which Modi sat was placed between two silver sidebars. Nobody, except the priests, is allowed to touch the four-headed Shiva Lingam inside the temple, a PADT official said.
After completing several pujas and rudris (another version of puja) inside the temple, the priests had gifted Modi sandalwood paste. Later, after completing the rituals inside the temple wearing sandalwood on his forehead and a rudraksha garland gifted by the priests, he paid tribute to the Bagmati river, which is also considered sacred by Hindus.
"He (Modi) seemed very happy throughout the puja, felt blessed and kept smiling throughout the puja," said Tandon.
Modi told the priest in the temple that his gotra (clan) is Kashyap.
After completing the puja, Modi wrote his remarks on the guestbook of Pashupatinath in Hindi language.
"The Pashupatinath Temple situated on the banks of Bagmati River is a unique centre of faith and belief," he wrote, according to the unofficial translation.
"The place finds mention in Himawat Khanda of Skanda Puran that states Kashi Vishwanath and Pashupatinath are the same," Modi stated.
"I am feeling delighted to come here on Ashtami Tithi of Shukla Paksha in the month of Shravan. May the grace of Pashupatinath continue to preserve on people of both Nepal and India."
As promised, after the temple visit, Modi handed over 2,500 kg of sandalwood worth Rs.20 million (over $320,260) and announced an assistance of Rs.150 million for building a 400-bed dharmasala within the temple precincts.
Though sandalwood is banned from being exported by the Indian government, it made an exception by providing this holy timber to the temple authorities as it is an integral part of the rituals in Pashupatinath temple.