After hundreds of millions of Indians cast ballots across megacities, mountains and islands, Prime Minister Narendra Modi won the biggest re-election India has witnessed in decades.

Mr. Modi, 68, has dominated India since he won a first term in 2014. Many Indians praise his efforts to stamp out corruption and bring development to poor regions.

Mr. Modi’s Bharatiya Janata Party and its allies won close to 350 seats in the 545-seat lower house of Parliament, according to nearly complete results. He is the first prime minister in nearly 50 years to win majorities in the Parliament in back-to-back elections, and now commands a sweeping mandate to govern a nation of 1.3 billion people.

To his supporters, Mr. Modi is entering the pantheon of India’s most legendary leaders, such as Jawaharlal Nehru, the country’s first prime minister, and Indira Gandhi, Mr. Nehru’s daughter and India’s iron lady of the 1960s, ’70s and early ’80s. India has no term limits, and people are already talking of a third Modi term.

Many voters were drawn to Mr. Modi’s intense speaking style, his reputation for getting things done and his carefully crafted image of being a tough defender of India. He called himself the chowkidar — the watchman — and he has pushed a more forceful foreign policy than India has pursued in years, including standing up to China, nearly going to war with Pakistan and drawing closer to the United States.

There was no election in the world as big as this one. About 600 million people voted, with more than 8,000 candidates contesting seats in the Parliament.

The elections were mostly peaceful, though there were a few sporadic clashes between supporters of rival parties. At least one person was killed.

The turnout was a record high, at 67.1 percent.

And despite strong passions, gargantuan numbers and high stakes, the elections have nearly concluded with no major allegations of fraud or rigging. Most of the voting was done on electronic voting machines that seemed to work just fine, according to observers and election officials.