Election Commission data by midafternoon showed the Bharatiya Janata Party leading in contests for 299 out of 542 seats in the lower house of Parliament, with its main rival, the Indian National Congress, ahead in 50 contests.
The data didn't indicate what percentage of the estimated 600 million votes cast over the six-week election had been counted. Although the final tally was not expected until Thursday evening at the earliest, BJP President Amit Shah claimed a victory, crediting Modi's "leadership."
Modi himself tweeted: "India wins yet again."
The election has been seen as a referendum on India's 68-year-old prime minister, whose economic reforms have had mixed results but whose popularity as a social underdog in India's highly stratified society has endured. Critics have said his Hindu-first platform risks exacerbating social tensions in the country of 1.3 billion people.
On the campaign trail, Modi presented himself as a self-made man with the confidence to cut red tape and unleash India's economic potential, and labeled Congress party president Rahul Gandhi, the scion of a political dynasty that lost power in 2014, as an out-of-touch elite.
The BJP's performance "is absolutely stunning. Modi is the predominant leader in India today. He has pushed everybody else aside. Nobody in the opposition is a match for him," said political commentator Arti Jerath.
Half a dozen exit polls released after voting concluded Sunday showed Modi and the Bharatiya Janata Party winning. A party or coalition needs a simple majority of 272 seats, or just over half the seats in Parliament's lower house, to govern.
"Mr. Modi's going to be the next prime minister, we are very assured of that," said Meenakshi Lekhi, a member of Parliament running for re-election in New Delhi. Shortly after officials began tabulating the votes, India's Sensex jumped 2.3% to an all-time high over 40,000.
If BJP's lead holds, it won't need a coalition partner to stay in power and could even improve its position compared to 2014, when it won 282 seats. This election may mark the first time in the party's history that it has two consecutive elections on its own.
World leaders, including Israeli Prime Minister Benjamin Netanyahu, Chinese President Xi Jinping and Sri Lankan President Maithripala Sirisena, congratulated Modi on Twitter.
Trends in the election data suggest that BJP's strategy of pursuing an aggressive campaign in eastern India paid off, with the party breaking into the citadels of Trinamool Congress Party in West Bengal state and the Biju Janata Dal in Odisha state. Picking up seats in these two states would compensate for projected losses in Uttar Pradesh in northern India.
The biggest losers appear to be the communists who ruled West Bengal state for 34 years until they were ousted by Mamata Banerjee's Trinamool Congress Party in 2011. Coalition partners of the Congress-led government in New Delhi between 2004 and 2008, the Communist Party of India (Marxist) was leading in only three constituencies and the Communist party of India in two constituencies.
Outside BJP headquarters in New Delhi, hundreds of people cheered and shouted party slogans, lifting cardboard cut-outs of Modi and BJP President Amit Shah into the air as other people played drums and set off fireworks.
Mohit Sharma, a 29-year-old who runs a bathroom fittings business, said India had never had a prime minister like Modi.
"In the past, when leaders after they won elections, they sat in air-conditioned rooms and they never reached out to people, but Modi was never like that. He was always connected to the people through social media," Sharma said.
Fashion designer Sandeep Verma, 39, said he wasn't a BJP supporter but had voted for the party in the elections.
"A country like India needs a decisive leader and the people did not find that in Rahul Gandhi. There was no alternative to Modi," Verma said.
The BJP harnessed social media, including Twitter, where Modi has 47.4 million followers, and WhatsApp to reach out to millions of supporters.
Modi also capitalized on a suicide bombing in Kashmir in February that killed 40 Indian soldiers. India retaliated with airstrikes at alleged terrorist training camps in Pakistan, fanning the flames of nationalism and helping the BJP turn voters' attention away from the flailing economy and onto matters of national security.
The airstrike "gave him the narrative he needed to counter all these allegations of non-performance, unemployment and rural distress. It reenergized him and enabled him to reclaim his image as a strong leader India needs at this juncture," Jerath said.
As votes were counted across India, Pakistan's military said it has successfully test-fired a long-range ballistic missile capable of carrying a nuclear warhead.
At Congress headquarters, only a few party workers stood outside looking dejected.
Jagdish Sharma, 50, blamed the counting method, using electronic voting machines, saying "Rahul Gandhi is the crowd's favorite, but has always lost only due to EVMs. While EVMs exist even Lord Vishnu can't defeat Modi," he said, referring to a powerful Hindu god.
Voters cast ballots on some 40 million electronic voting machines, a method India began using 15 years ago after complaints that the manual count of paper ballots was tainted by fraud and abuse. But losing candidates and political parties have raised doubts about the accuracy and reliability of the electronic method, doing so again this week.
Top opposition leaders met with Election Commission officials on Tuesday after videos appeared on social media showing some electronic voting machines being moved. The party officials alleged that the machines were going to be altered, but the commission said the images showed unused machines being moved into storage.
Associated Press journalists Rishabh R. Jain, Bharatha Mallawarachi and Ashok Sharma contributed to this report.
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.