Pakistan said the meeting was held amid immense goodwill in very cordial atmosphere.
"The PM Modi-Pak PM Nawaz Sharif meeting was held in very cordial atmosphere... It has been decided there will be greater interaction, people to people contact, to create an environment of goodwill," said Pakistan Foreign Secretary Aizaz Chaudhry.
Mr Sharif, who is celebrating his 66th birthday today, received PM Modi at the airport with a hug and then flew him by chopper to his sprawling ancestral home near Lahore, where the two held talks for over an hour. The palatial home was decorated with fairy lights for the wedding of the Pakistani PM's granddaughter.
After landing in Delhi, PM Modi tweeted about the stop-over, describing it as "a warm evening" spent with the Sharif family.
Spent a warm evening with Sharif family at their family home. Nawaz Sahab's birthday & granddaughter's marriage made it a double celebrationNarendra Modi (@narendramodi) December 25, 2015
For their "chai pe charcha", the menu was vegetables, kheer and Kashmiri tea, said reports. Mr Sharif later saw off PM Modi at the airport.
Am personally touched by Nawaz Sharif Sahab 's gesture of welcoming me at Lahore airport and coming to the airport when I left.Narendra Modi (@narendramodi) December 25, 2015
The jaw-dropping diplomatic gesture, say sources, followed a decision taken this morning when PM Modi called Mr Sharif to wish him.
This was his first visit to Pakistan since taking office last year and the first visit by an Indian prime minister in 12 years.
Not long before the tweet, PM Modi had, in his address to a joint session of the Afghan Parliament in Kabul, appeared to send a strong message to Pakistan, without naming the country. "There are some who did not want us to be here. There were those who saw sinister design in our presence here... But we are here because you had faith in us," he had said.
Looking forward to meeting PM Nawaz Sharif in Lahore today afternoon, where I will drop by on my way back to Delhi.- Narendra Modi (@narendramodi) December 25, 2015
The casual announcement in a tweet belied the significance of the gesture after a long period of cold vibes between the two nations.
"That's like a statesman. Padosi se aise hi rishte hone chahiyen (ties with neighbours should be like this)," tweeted Foreign Minister Sushma Swaraj.
While many see a new, radical approach to ties with Pakistan away from the media glare and politics, the opposition was deeply critical.
"Diplomacy has gravitas and maturity. It is not a joke, only for news. The PM has no vision," said former union minister Anand Sharma of the Congress.
The two prime ministers last met in Paris on the sidelines of the Climate Change Summit on November 30. Their handshake and short chat was the lead-in to talks between the National Security Advisers of the two countries and Sushma Swaraj's visit to Islamabad for an Afghan conference earlier this month. Both foreign secretaries are to meet in January.
Atal Bihari Vajpayee, who turned 91 today, was the last Indian Prime Minister to go on a bilateral visit to Pakistan in 1999. Many in the government have likened PM Modi's Lahore drop-in to Mr Vajpayee's bus ride to Lahore.