BANGKOK, May 14 (Reuters) - Thailand's opposition secured a stunning election win on Sunday after trouncing parties allied with the military, setting the stage for a flurry of deal-making over forming a government in a bid to end nearly a decade of conservative, army-backed rule.

The liberal Move Forward party and the populist Pheu Thai Party were far out in front with 99% of votes counted, but it was far from certain either will form the next government, with parliamentary rules written by the military after its 2014 coup skewed in its favour.

To rule, the opposition parties will need to strike deals and muster support from multiple camps, including members of a junta-appointed Senate that has sided with military parties and gets to vote on who becomes prime minister and form the next administration.

Sunday's election was the latest bout in a long-running battle for power between Pheu Thai, the populist juggernaut of the billionaire Shinawatra family, and a nexus of old money, conservatives and military with influence over key institutions at the heart of two decades of turmoil.

But the staggering performance by Move Forward, riding a wave of support from young voters, will test the resolve of Thailand's establishment and ruling parties after it came close to a clean sweep of the capital Bangkok on a platform of institutional reform and dismantling monopolies.

Move Forward came top, followed closely by Pheu Thai, the preliminary results showed. According to a Reuters calculation, both were set to win more than triple the number of seats of Palang Pracharat, the political vehicle of the junta, and the army-backed United Thai Nation party.

Move Forward leader Pita Limjaroenrat, a 42-year-old former executive of a ride-hailing app, described the outcome as "sensational" and vowed to stay true to his party's values when forming a government.

"It will be anti- dictator-backed, military-backed parties, for sure," he told reporters. "It's safe to assume that minority government is no longer possible here in Thailand."

He said he remained open to an alliance with Pheu Thai, but has set his sights set on being prime minister.

"It is now clear the Move Forward Party has received the overwhelming support from the people around the country," he said on Twitter.