By Rupam Jain and Tommy Wilkes

NEW DELHI (Reuters) - Prime Minister Narendra Modi's party won a landslide victory in India's most important battleground state on Saturday, in a personal triumph that will strengthen his claim to a second term as national leader.

Wresting control of Uttar Pradesh is a ringing endorsement of Modi's stewardship of Asia's third-largest economy after his high-risk decision last November to scrap high-value banknotes to rein in corruption.

The Election Commission of India said Modi's Bharatiya Janata Party (BJP) had won a clear majority. With the tally of results almost complete, the BJP had collected as many as 312 of 403 seats in the state assembly, the biggest majority for any party in the state since 1977.

Almost four in ten voters backed Modi's party, the election commission said, close to the party's vote share in Uttar Pradesh in the 2014 general election when it won the biggest national majority in three decades.

"I give my heartfelt thanks to the people of Uttar Pradesh. This is a historic victory for the BJP; a victory for development and good governance," Modi told his 28 million followers on Twitter.

Investors hope victory will embolden Modi to embark on more reforms, including the launch of a national sales tax, to boost economic growth.

"The outcome of this election will enable Modi to sharpen his winning anti-corruption and improved governance policies as he begins to position himself for the 2019 general election," wrote analysts Shailesh Kumar and Sasha Riser-Kositsky of macro advisory firm Eurasia Group.

Modi threw himself into the Uttar Pradesh campaign after his party started slowly, addressing dozens of rallies and turning the contest into a test of his personal popularity and his radical move to abolish big banknotes worth 86 percent of the cash in circulation.

Celebrations erupted outside BJP offices in state capital Lucknow and Delhi, with party workers dancing and splashing each other with paint in keeping with the Holi festival of colors that Hindus are celebrating this weekend.

Modi's campaign manager, Amit Shah, credited the BJP victory to a corruption free and pro-poor administration. The BJP will discuss who will become the next chief minister of Uttar Pradesh on Sunday, Shah told reporters.

OPPONENTS DECIMATED

In four other state election results on Saturday, the BJP won overwhelmingly in the Himalayan state of Uttarakhand but lost control of the coastal state of Goa. In the northeastern state of Manipur the Congress party beat the BJP into second but was short of a majority.

Congress took Punjab, offering at least some consolation after Rahul Gandhi, heir apparent to the party leadership, failed again to make an impact.

The party, which led the fight against colonial rule and has ruled India for most of its independent existence, collapsed to its worst ever performance in Uttar Pradesh. Congress picked up 6 percent of votes, raising fresh questions about its claim to be a credible national opposition.

In Uttar Pradesh, a largely poor and agricultural state of 220 million people, Modi pitched himself as a man on the side of the poor prepared to hit the corrupt rich hard with his demonetisation drive.

The scale of the victory shows Modi's ability to decipher Indian electoral arithmetic by appealing across castes and communities in a state where most people traditionally vote along religious and social lines.

Critics accuse his party of stirring communal tensions to shore up votes among its core Hindu base.

None of the BJP's opponents, including the ruling Samajwadi Party, managed a vote share above 23 percent, results showed.

"The Samajwadi Party wholeheartedly accepts the verdict of the people of Uttar Pradesh," spokesman Ghanshyam Tiwari said, conceding defeat. Chief Minister Akhilesh Yadav was expected to resign later on Saturday.

The election decimates the field of plausible opponents who could halt Modi's march to a second term at the 2019 general election.

Victory in Uttar Pradesh will also make it easier to overcome resistance to the BJP's legislative agenda in the upper house of parliament, where the ruling party is in the minority.

(Additional reporting by Krishna N.Das, Malini Menon and Savio Shetty; Editing by Simon Cameron-Moore and Toby Chopra)