The opposition in Venezuela has won a majority of seats in the National Assembly, overturning nearly two decades of dominance by the Socialists of President Nicolas Maduro.
Five hours after polling ended, the National Electoral Council announced the opposition had won 99 seats.
The Socialists have gained 46 seats, with another 22 yet to be declared. President Maduro has admitted defeat. saying his party recognised "these adverse results".
The opposition alliance, made up of centre and conservative parties, is confident of ultimately taking at least 112 seats after 17 years of socialist rule.
According to senior figures in the movement, that would allow them to pass laws allowing the release of political prisoners and to reverse, for example, appointments to senior legal positions made by the current government, the BBC's Wyre Davies reports from Caracas.
"The results are as we hoped. Venezuela has won. It's irreversible," tweeted Henrique Capriles, a leading opposition figure in the Democratic Unity Roundtable and a former presidential challenger.
However, under Venezuela's presidential system the United Socialist Party of Venezuela (PSUV) will still be a powerful force, as it also controls many municipalities.
The elections were widely seen as a referendum on President Maduro, the handpicked successor of the late President Hugo Chavez, and the party's socialist policies.
The opposition accused the PSUV of mismanaging the economy and of squandering the country's oil wealth.
Mr Maduro says his party defends the interests of ordinary Venezuelans and wants to complete Mr Chavez's "Bolivarian Revolution".
Among the campaign issues were chronic food shortages of staples - such as milk, rice, coffee, sugar, corn flour and cooking oil.
Mr Maduro has blamed the situation on an "economic war" waged against his government by the opposition.
The opposition also accused the government of increasing authoritarianism.
Earlier this year opposition leader Leopoldo Lopez was given a 13-year prison sentence for inciting violence - a charge critics say was politically motivated.
Venezuela invited election monitors from regional body Unasur but rejected those from the Organisation of American States (OAS) and the European Union.