Myanmar's opposition National League for Democracy has won a landslide election victory, officials say.
With more than 80% of contested seats now declared, Aung San Suu Kyi's party has more than the two-thirds it needs to choose the president, ending decades of military-backed rule.
A quarter of seats are automatically held by the military, meaning it remains hugely influential.
Under the constitution, Ms Suu Kyi cannot become president herself.
Despite this, the election was seen as the first openly contested poll in Myanmar - also known as Burma - in 25 years.
Analysis: Jonah Fisher, BBC News, Yangon
Next stop for Aung San Suu Kyi are talks with President Thein Sein and the army Commander-in-Chief Min Aung Hlaing. They are likely to happen in Nay Pyi Taw next week.
There is plenty to discuss and Ms Suu Kyi is likely to try and reassure them that her government will be inclusive, and not purely made up from her NLD party.
Then there is the thorny issue of the upcoming "lame duck" parliamentary session. Incredibly, the members of the old pre-election Burmese parliament are due to gather next week for a final session that runs until the end of January.
It has full powers to pass legislation and with the vast majority of the MPs having been booted out on Sunday this could be an opportunity for all manner of consequence-free political skulduggery.
Only once the "lame duck" session ends will the new NLD-dominated parliament gather. It will immediately choose a new speaker, quite possibly Ms Suu Kyi, before selecting two vice-presidents and a president.
By early Friday, the NLD needed two more votes to reach the threshold required for a majority.
Then at midday, the electoral commission said the party had taken 348 of the 664 seats in the two houses of parliament. This represents a two-thirds majority of the contested seats.
With votes still being counted, the NLD's tally rose to 369 seats later in the day. The final tally is not expected for several days.
Confirmation of the victory came exactly five years since Ms Suu Kyi was released from house arrest by the military.
The process of choosing a new president will begin in January, when the new parliament gathers.
Our correspondent Jonah Fisher says the election has been remarkable both in the peaceful and largely fair way it was run and by the response of the losing side.
Does the NLD now control Myanmar?
Not really - it has enough seats in the upper and lower house to choose the president but the army has 25% of seats and controls key ministries, so they will need to work together.
Will Aung San Suu Kyi be president?
No - the constitution, written by the military, bars people with foreign spouses or offspring, as she does, from the top job. The clause was widely seen as being written specifically to prevent her from taking office. But Ms Suu Kyi she has repeatedly said she would lead the country anyway if the NLD won.
Can the NLD just change the constitution?
No - the military can veto any moves to change it.
Was the election free?
"Largely," said Ms Suu Kyi. But hundreds of thousands of people, including the minority Muslim Rohingya, were not allowed to vote, and no voting took place in seven areas where ethnic conflict is rife.
Current President Thein Sein and the head of the military had already said they would respect the outcome and work with the new government.
About 30 million people were eligible to vote in the election - turnout was estimated at about 80%.
It was widely seen as a fair vote though there were reports of irregularities, and hundreds of thousands of people - including the Muslim Rohingya minority, who are not recognised as citizens - were denied voting rights.
The ruling military-backed Union Solidarity Development Party (USDP) - which won the last, widely criticised election five years ago - has so far gained about 5% of seats contested.