Addressing Buddhist monks at the temple, Modi said Vietnam was an inspiration for everyone to shun violence and follow Buddha's path of peace and harmony.
"World should walk on the path of peace that brings happiness and prosperity, while war only brings transient greatness," the prime minister said.
"The advent of Buddhism from India to Vietnam and the monuments of Vietnam's Hindu Cham temples stand testimony to these bonds," Modi said.
Modi emphasised that his visit to Vietnam - the first by an Indian premier in 15 years - was to "nurture a relationship between our two societies and nations."
More From This Section
"These cultural bonds reflect themselves in many ways. Most prominently, in the connect between Buddhism and the monuments of the Hindu Cham civilization," he said.
"Some people came here with the objective of war. We came here with a message of peace which has endured," Modi said.
Modi said Buddhism, which took the sea route, travelled to Vietnam in its purest form from India.
He said he is fortunate to visit the Pagoda temple after first President Rajendra Prasad in 1959.
The Quan Su Pagoda, also known as Ambassador's pagoda, is said to have served emissaries that were sent from Champa and Laos to Vietnam in the past. The pagodas - a Buddhist heritage and popular toursit sites - are at the heart of Vietnamese Buddhism and are a precious treasure of Hanoi.
The pagoda is said to have served emissaries that were sent from Champa and Laos to Vietnam in the past.
"Earlier this morning, you made the special gesture of personally showing me Ho Chi Minh's house... Thank you, Excellency, for extending me the privilege. Let me also congratulate the people of Vietnam on their national day that you celebrated yesterday," he said.
(Reopens FGN 11)
Modi also congratulated the people of Vietnam on their national day yesterday and laid a wreath at the Monument of National Heroes and Martyrs of Vietnam located across the Ba Dinh Square, across the Ho Chi Minh Mausoleum.
Earlier today the prime minister was given a ceremonial welcome at the palace as he became the first Indian prime minister to visit the communist nation in 15 years.
"For people of my generation, Vietnam holds a special place in our hearts. The bravery of the Vietnamese people in gaining independence from colonial rule has been a true inspiration. And, your success in national reunification and commitment to nation building reflects the strength of character of your people," Modi said.
"The Cuu Long Delta Rice Research Institute, is a prime example of the enormous impact of our cooperation.India helped set up the institute in the Mekong Delta, sending agricultural experts and training its faculty in India," he added.