Modi, who is visiting China this week to boost economic ties and discuss a persistent border dispute, is known for being at ease with social media, including a large follower base on Twitter.
But such spontaneous displays online are rare for leaders in China, where discussion of politicians' personal lives is taboo and details such as their exact birthdates are considered a state secret.
Read: 'Shady business': Modi's visit to China museum causes social media frenzy
The selfie, which shows the leaders at a historical site smiling shoulder to shoulder, with Li squinting slightly in the sunlight, was posted on Modi's Chinese microblog account. He spent the day in talks with Li during his three-day trip and is set to travel to the economic powerhouse of Shanghai on Saturday.
Modi set up an account on the microblogging site Weibo, China's answer to Twitter, ahead of his trip, prompting a flurry of mostly sceptical messages from the Chinese public.
China's leadership has experimented with more unscripted interactions in recent years. President Xi Jinping surprised residents near a popular Beijing shopping street when he took a stroll there last February.
He also astonished customers at a modest steamed bun shop by turning up, paying for his own food and making small talk with other patrons.
Read: India's Modi tells China to 'reconsider' approach
Many Weibo users reacted with delight to the two leaders' selfie, with messages like "cute premier!" Others wondered why China's own leaders had no social media presence.
"Wouldn't it be great if Premier Li had his own Weibo?" one user wrote. "Then we could respond to him directly."
COMMENTS (8)
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ