Counting of the more than 600 million votes began at 8 a.m. local time (0230 GMT) and trends were expected to be known by noon. Final results are due by Thursday evening.
Modi was under pressure when he began campaigning, losing three state elections in December amid rising anger over farm prices and unemployment.
However, campaigning shifted towards India's relationship with nuclear-armed rival Pakistan after a suicide car bomb killed 40 Indian police in the contested Kashmir region in February, to the benefit of the right-wing BJP, analysts said.
"National security became the discussion," said Harsh Pant, a political analyst at the Observer Research Foundation think-tank in New Delhi. "It allowed the BJP to shirk some issues where it was weak."
The BJP has also capitalised on the star power of Modi, a frenetic campaigner, as well as superior financial resources.
It outspent the main opposition Congress Party by six times on Facebook and Google advertising, data showed, and by as much as 20 times overall, sources told Reuters earlier this month.
"The longer election certainly helps Modi: he loves contact with the people," Pant said. "The BJP's electoral machinery is also much more effective on the ground."
The NDA held a meeting on Tuesday, at which Modi was garlanded with flowers by members of the alliance, to discuss its policy agenda for its second term in power. It has promised to double farmers' income and boost infrastructure spending over the next five years.
Several opposition leaders attempting to unseat Modi have urged voters to wait for the final results, calling the exit polls "gossip".
"Do not get demoralised by the fake exit polls doing the rounds," Congress president Rahul Gandhi said in a message to party workers posted on social media on Wednesday.
The opposition alliance has also protested to India's Election Commission over the electronic voting machines (EVMs) used in the count, which they alleged could be tampered with, and requested a delay to counting while votes were tallied with a backup paper audit trail.
The commission rejected the opposition's demands on Wednesday.
Around 500 masked people carrying guns and machetes attacked a polling team and forcibly took away EVMs in the remote northeastern Indian state of Arunachal Pradesh, Reuters reported on Wednesday, although the election was widely considered by international observers to be free and fair .
Indian stocks posted their biggest gain since September 2013 on Monday and could rally further on Thursday if the trend is confirmed, according to a Reuters poll.
"Markets will heave a big sigh of relief as it favours continuity and familiarity in terms of roll-out of policies," said Ajay Bodke, CEO at financial services firm Prabhudas Lilladher.
(Reporting by Alasdair Pal, additional reporting by Indradip Ghosh and Vivek Mishra in BENGALURU Editing by Sanjeev Miglani, Nick Macfie and Paul Tait) ((Alasdair.Pal@thomsonreuters.com; +91 114 954 8060; Reuters Messaging: email@example.com))