Venezuela's opposition won control of congress for the first time in 16 years Monday as voters punished the socialist government for an economic crisis and insecurity in the oil-rich nation.
President Nicolas Maduro promptly accepted the defeat, a blow to his leadership and the "revolution" of "21st century socialism" launched by his late predecessor Hugo Chavez.
The result was a triumph for the center-right opposition, which has struggled for years for a foothold and has seen many of its leaders jailed.
The Democratic Unity Roundtable (MUD) coalition won a majority of 99 out of 167 seats in the state legislature, the head of the National Electoral Council (CNE), Tibisay Lucena, announced shortly after midnight, five hours after polls closed.
Fireworks erupted over the capital Caracas as opposition supporters celebrated.
"Venezuela has won," tweeted Henrique Capriles, leader of one of the parties in MUD.
It was unclear, however, how far the MUD will be able to push its advantage in congress to force a change of course or even to get rid of Maduro, who vowed to push on with his socialist programs.
"We have come with our morals and our ethics to recognize these adverse results, to accept them and to say to our Venezuela that the constitution and democracy have triumphed," the 53-year-old said in a televised address.
"We have lost a battle today, but the struggle to build a new society is just beginning."
Maduro's United Socialist Party of Venezuela won 46 seats in the single-chamber National Assembly, Lucena said. The results for 22 other seats have yet to be confirmed.
Maduro called for the opposition to "live together" with his side.
His tone was softer than before the elections, when he had vowed to hold onto power "no matter how."
After warnings of a repeat of last year's deadly riots that left 43 people dead, his acceptance of defeat seemed aimed at calming tensions -- though he stuck to his political position.
"A counter-revolution has triumphed, which has imposed its own way, its war," he said, in reference to what he alleges is a US-backed "economic war" against Venezuela by businesses.
Maduro's supporters fear an opposition-dominated congress will stop approving his social spending programs.
Hit by falling prices for the oil exports on which it relies, the country of 30 million is in an economic crisis, with shortages of basic foods and supplies.
Voters also complained of insecurity in a country ranked by the United Nations as having the second-highest murder rate in the world.
Venezuela has the globe's biggest oil reserves but also widespread poverty.
"This is a big punishment vote by the people for Maduro's management," said Luis Vicente Leon, president of pollster Datanalisis.
Latin America shifting right?
Chavez's election as president in 1999 marked the start of an era of powerful left-wing governments across Latin America.
Now some political analysts wonder whether Sunday's result could reflect a broader rightward political shift in the region.
Argentines last month voted out their leftist president Cristina Kirchner.
Brazil's leftist President Dilma Rousseff, meanwhile, has suffered a collapse in support and now faces impeachment proceedings in a judicial affair.
"Change has begun today in Venezuela," said MUD's executive secretary, Jesus Torrealba, adding that the coalition didn't want "revenge."
He joined hands with another prominent face in the opposition, Lilian Tintori.
Her husband Leopoldo Lopez was jailed last year by Maduro after being convicted of inciting violence in the riots.
A prosecutor in the case later said false evidence was used against him and his supporters say he is a political prisoner.
Lopez's fate will be a delicate issue in the new power dynamic in Caracas. The opposition hope to use their legislative weight to free their jailed allies.
Some leaders and analysts had warned that radicals within the MUD would take to the streets, but opposition leaders called for peaceful change.
"We do not want violence," Tintori said.