There was a big terrorist attack in Indian Kashmir. 40 paramilitary lost their lives, three months before the national elections.
Modi responded by airstrikes on the purported base in Pakistani Kashmir where the attack was supposedly organised from. India claimed to have killed 300 terrorists. It was basically an act of war on Pakistan. Pakistan responded, shot down an Indian pilot, who was later returned, and celebrated as a hero in India.
The resulting jingoism boner, boosted tremendously by basically the entire national media, essentially wiped every other electoral issue from the public arena, including some significant economic and policy failures of the first years of Modi being in power.
Before the attack, Modi’s BJP seemed to be on course to be the largest party, but it was expected he would need to form a coalition, and therefore temper the Hindu supremacist wing of his party to be able to govern. Instead his party alone won a big majority.