This was achieved on Saturday when a remote village in the north-eastern state of Manipur became the last to be connected to the grid.
A village is considered electrified if 10% of its homes and all public buildings are connected to the grid.
World Bank figures show around 200 million people in India still lack access to electricity.
Mr Modi said all of nearly 600,000 villages in India have now been given electricity connection.
Correspondents say it’s a great achievement for Asia’s third largest economy.
However, some people said on Twitter that their villages had yet to get access to electricity despite government claims.
India is the world’s third largest producer and consumer of power. But poor distribution has been one of the biggest challenges.
In August 2015, Mr Modi launched a $2.5bn (£1.8bn) scheme to electrify all Indian households by December 2018.
As part of this scheme, all 597,464 inhabited villages in the country and more than five million households have been connected to the grid.
Mr Modi made the announcement in a series of tweets after Leisang village in the north east became the last village to be connected to the grid. The village is home to 19 families, according to the 2011 census.
How does India define electrification?
The government considers a village to be electrified if the number of households electrified is at least 10% and electricity is provided to public buildings including schools, health centres, dispensaries, community centres and village councils.
So, by definition, all Indian villages have now been electrified.
But government data shows that every household has access to electricity in just six Indian states – Tamil Nadu, Kerala, Andhra Pradesh, Punjab, Goa and Gujarat.
Why is complete electrification a challenge?
Remote and inaccessible villages have always proved to be a major challenge in the country’s electrification drive.
Though most Indian villages have some electrical connection today, connecting the last remote households in the surrounding areas can be expensive.
Some people may also forgo accessing electricity by choice because of the monthly bills that come with it, especially if power supply is not reliable and blackouts are frequent.
Additionally, state-owned power distribution companies are struggling with debt and poor demand, which has made it difficult to practically electrify every Indian household.