Thai voters have taken part in the country's first general election since the 2014 coup.
Thailand has been buffeted by political instability for years, largely a battle between supporters of the military and ousted former PM Thaksin Shinawatra.
After seizing power the army promised to restore order and democracy, but has repeatedly postponed the vote.
Critics say a new constitution the army introduced will ensure it remains influential whatever the outcome.
More than 50 million people are eligible to vote and the authorities said turnout could be as high as 80%.
More than seven million people aged between 18-26 have the right to vote for the first time and could be key to victory, so all parties have been keen to court their vote.
On the eve of the election, Thailand's King Maha Vajiralongkorn issued a statement urging "peace and order" during the voting process.
The statement, which was featured on national television on Saturday evening, urged voters to "support the good people".
A simple choice
By Nick Beake, BBC News, Bangkok
Voters in central Bangkok faced a final obstacle as they tried to cast their ballot - determined runners steaming through the park where an open-air polling station had been set up.
But after waiting five years since the military coup, Thais are determined to finally have their say on their country's future - even if the electoral system has been skewed by the ruling junta to try to keep them in power.
The beaming faces of the 31 different candidates here in the Klong Toey constituency look out from a big poster which provides a last-minute visual guide for those picking up their ballot papers. Really, though, this election boils down to a simple choice - do you want the army to stay in power?
We meet Peerasin, 23, who is one of seven million first-time voters. He and his mum explain that they're hopeful for change but that dad is more conservative. Dad nods and smiles in agreement.
Next, a family of eight arrive to cast their votes. Sisters Mai, a banker and May, who works in the pharmaceutical industry, say they don't talk politics at home. But that doesn't mean they don't have passionate opinions.
So what's your message to whoever wins power, I ask.
"The country has been suffering for a long time", Mai explains. "But we hope this election will end peacefully and that there will be no corruption. We are hopeful."
The election is primarily a contest between pro-military parties and allies of Mr Thaksin.
He was ousted in a coup in 2006 and lives in self-imposed exile to avoid a conviction for abuse of power. But he still has a significant following, largely among rural and less affluent voters.
Parties loyal to Mr Thaksin have won every election since 2001, and the BBC's South East Asia correspondent Jonathan Head says crippling this movement has been a central - if unofficial - objective of the military.
Pheu Thai (For Thais) is the leading Thaksin-loyal party campaigning this time.
General Prayuth Chan-ocha, who led the coup which ousted Mr Thaksin's sister Yingluck Shinawatra in 2014, has been nominated as the only prime ministerial candidate of the newly formed pro-military Palang Pracha Rath Party (PPRP).
Among other prominent parties are the Democrats, led by former prime minister Abhisit Vejjajiva, and the new Future Forward party, led by a young billionaire, Thanatorn Juangroongruangkit.
At the time of the coup, the military said it wanted to restore order and stability and prevent the street protests which have broken out repeatedly over the years.
But the junta has been accused of taking an authoritarian approach to power, strictly controlling the media and arbitrarily using laws like lese majeste - which prohibits any criticism of the monarchy - to silence opponents.
It also introduced a constitution - approved by a referendum - which its critics say is designed to ensure it remains central in Thai politics.
More news from Thailand
Voters on Sunday will be electing 500 members of the lower house of parliament. But under the constitution, a 250-seat senate has been appointed by the military.
The two houses will together elect a prime minister - a candidate only needs half the votes plus one to win.
So the military's preferred candidate - Gen Prayuth - would in theory only need 126 lower house votes to take office. The governing party or coalition can also appoint a non-MP as prime minister.
The new constitution also imposes a limit on the number of seats any one party can take, regardless of the number of votes won, and any future government is constitutionally bound to follow the military's 20-year plan for Thailand.
Preliminary unofficial results will emerge within hours, but correspondents say it will take some time for the future direction of Thailand to become clear, as parties negotiate deals and coalitions.