The opposition Alliance of Change in Mauritius has won 60 of the 64 seats in parliament following Sunday's general election.
Its leader, Navin Ramgoolam, 77, has been appointed prime minister.
The man he has replaced, Pravind Jugnauth, 62, already acknowledged on Monday that his Lepep alliance was heading for a "huge defeat". It now has two seats in parliament compared to the 42 after the 2019 election.
Mauritius is known as one of Africa's most stable democracies, but this election was tainted by a phone-tapping scandal, with leaked recordings of public figures posted online.
In response, the government issued a social media ban until after the election, although this led to an outcry and the decision was reversed within 24 hours.
Ramgoolam, a former doctor, is beginning his third period as the country's prime minister. He was also in the job for five years from 1995, and between 2005 and 2014.
The Alliance for Change won 63% of the vote, the Lepep alliance got 28%.
Ramgoolam said he was moved by the extent of people's support.
"The court of the people has delivered its verdict and a new Mauritius awakes," he told supporters.
"We must respect this choice… and we wish the country and the population good luck," said Jugnauth.
The mood in the capital Port Louis reflected this changing tide, as people gathered on Monday in anticipation of results that signalled a fresh direction for the country.
They were dancing and singing in the streets and blowing vuvuzelas. They also waved the country's flag and held fire crackers.
Ibrahim, who voted for the Alliance for Change told the BBC that "growing public dissatisfaction" was a major reason the ruling party lost.
The cost-of-living crisis has been a major issue for many Mauritians, along with a growing concern about governance and corruption.
On the campaign trail, both parties promised to improve the lives of people on the islands.
Ramgoolam – whose father was a liberation hero – said he would increase pensions, introduce free transport and internet and reduce fuel costs.
Mauritius' former foreign minister and a member of the opposition coalition, Arvin Boolell, told the BBC's Newsday programme the election was a "victory of the people".
Voter turnout was about 80%, according to the electoral commission.
The vote comes after a historic agreement in which the UK gave up sovereignty over the Chagos Islands to Mauritius.
Go to BBCAfrica.com for more news from the African continent.
Follow us on Twitter @BBCAfrica, on Facebook at BBC Africa or on Instagram at bbcafrica
Analyst Alex de Waal looks at how the US president-elect could deal with conflicts on the continent.
They are accused of hate speech as rights groups say the law is being used to restrict freedoms.
Dawit Isaak has been held without trial in an Eritrean prison for 23 years.
In an echo of the US, the current vice-president is up against an ex-president in the 7 December vote.
Martha Koome says the recent allegations of corruption within the judiciary are based on misogyny.
Copyright 2024 BBC. All rights reserved. The BBC is not responsible for the content of external sites. Read about our approach to external linking.