CARACAS, Venezuela — On a sunny afternoon, Jorge Millán, an opposition candidate for congress, walked through the narrow streets of a lower-middle-class neighborhood, pressing the flesh in what was once a no man’s land for people like him.  In 2012, the opposition presidential candidate, Henrique Capriles, was confronted in the same neighborhood by an armed motorcycle gang wearing the red shirts of supporters of Venezuela’s longtime leader, Hugo Chávez. They blocked the street and fired shots in the air.  But now, the mood had changed considerably. “Vote on Sunday. Vote for change,” Mr. Millán said over and over. He was greeted with hugs, kisses and smiles.  Venezuelans go to the polls on Sunday in legislative elections that could change the political balance in Venezuela, a country that has long been painfully split between the followers and opponents of Mr. Chávez and his successor, President Nicolás Maduro.  With the economy sinking under the weight of triple-digit inflation, a deep recession, shortages of basic goods and long lines at stores despite the nation’s vast oil reserves, the opposition has its best chance in years to win a legislative majority.  President Nicolás Maduro of in Venezuela and the opposition leader Jesús Torrealba appealed to voters ahead of Sunday's legislative elections, which could change the political balance in the country.  The opposition candidates for the 167 seats up for grabs in the National Assembly have been hammering home a one-word message: change.  And it seems to be hitting the mark.  “I want change for the country so we can have something better,” said Ismer Díaz, 26, who voted for Mr. Maduro and supported Mr. Chávez, who was president for 14 years.  Working behind the counter at a small grocery, he shook Mr. Millán’s hand and took a leaflet. He admitted a few minutes later that he did not know Mr. Millán’s name but said that he planned to vote for him anyway, a throw-the-bums-out attitude that is widespread here.  The ballots will show each candidate’s name with a party symbol, in this case the thumbs-up logo of the Democratic Unity coalition that agglomerates most opposition parties.  Down the street, Jesús Omaña, 37, a motorcycle taxi driver, also shook Mr. Millán’s hand.  “I was a Chavista, but Chávez isn’t here anymore,” said Mr. Omaña, referring to the followers of the former president.  “It’s this guy,” he said, referring to Mr. Maduro. “It’s not the same.”  Mr. Omaña complained about having to stand in long lines to buy food and about the fast-rising prices, saying that for the first time since Mr. Chávez was elected in 1998 he would vote for an opposition candidate.  “Enough is enough,” he said. “We need something good for Venezuela.”  Venezuelan politics was dominated after 1998 by Mr. Chávez and the movement he started, which he called the Bolivarian revolution, after the country’s independence hero, Simón Bolívar. Mr. Chávez died in 2013, and his disciple, Mr. Maduro, was elected to succeed him, vowing to continue Mr. Chávez’s socialist-inspired policies.  But Mr. Maduro lacks Mr. Chávez’s magical connection with supporters, and even his good luck. Venezuela’s economy depends enormously on oil production, and during much of Mr. Chávez’s presidency oil prices were very high. Now they have dropped significantly, putting a severe strain on the country’s budget.  Mr. Maduro has also stuck ardently to many of the economic policies Mr. Chávez left behind, such as strict controls on prices and foreign exchange, which economists say are now making things worse.  Mr. Chávez greatly expanded the power of the executive branch and eliminated checks and balances, dominating a weak judiciary and packing the electoral council with loyalists, while the National Assembly acted as a rubber stamp. That has continued under Mr. Maduro.  But if the opposition wins a majority in the National Assembly, it would change the political balance in profound ways and set up a power struggle with Mr. Maduro and the government institutions that he controls.  The once powerful Chavista movement has shown itself to be greatly weakened by the country’s economic debacle and Mr. Maduro’s leadership. Rallies for the candidates of Mr. Maduro’s United Socialist Party have been much more tepid than similar gatherings in the past under Mr. Chávez.  And Mr. Maduro, despite saying repeatedly that he is confident of a victory on Sunday, has foreshadowed defeat.  During his weekly television program on Tuesday, he called the possibility of an opposition victory a “nightmare” and said that if “we were to lose Sunday’s elections, life goes on, the fight goes on, and the revolution would find new paths and a new character.”  If the government loses its majority, “we would take to the streets to fight, to do battle, to defend our country,” Mr. Maduro said.  The government has warned that if the opposition takes over Congress, it will strip away the social programs created by Mr. Chávez.  If that were to happen, Mr. Maduro said, “with the Constitution in my hands I would declare myself in total rebellion with the people mobilized in the streets. You can be certain I will never allow it.”  Mr. Maduro, in the style of Mr. Chávez, has made himself the principle campaigner for his party, and he led its final rally, in a street in central Caracas, on Thursday. At several points, he paused for a response from the crowd but got only scattered cheers.  “I’ve always been with” the governing party, “but with all the calamities that we’re going through I’m having my doubts,” said Natalia Rojas, a schoolteacher, who said she attended the rally because she felt pressured to do so at work. She said the rally suffered in comparison with those of past years when Mr. Chávez generated great excitement.  “Not many people and lots of government workers standing around being apathetic,” she said.  Mr. Maduro claims that the country’s economic problems are the product of an economic war waged against him by capitalist enemies, abetted by a biased news media, a message often repeated by his followers.  “I support my government totally, and we are going to win,” said Minathay Ferrer, 40, a government worker. “Things are bad, but it makes me angry when people say we are going to lose. It’s media warfare.”  The government has plowed public resources into its campaign, as it has for years. Mr. Maduro and other officials preside over giveaways of apartments, cars and other goods. Government-controlled television and radio stations and newspapers trumpet the government message and savage opponents.  Even the ballot has pitfalls, critics contend. Right next to the blue logo of the Democratic Unity coalition is a similar blue logo for a tiny party that also features the word “unity” in its name, a juxtaposition that opposition leaders say is meant to confuse voters. In one district, the other unity party is even running a candidate with the same name as the Democratic Unity candidate, Ismael García, and the two names will appear side by side on the ballot, with similar blue logos.  The campaign has been marred by violence, most notably when a local opposition activist, Luis Díaz, was shot dead at a rally late last month. The opposition blamed the government, which critics say has often looked the other way as armed gangs affiliated with it intimidated political opponents — as when Mr. Capriles was confronted during the 2012 campaign in the Caracas neighborhood that Mr. Millán recently visited.  Opposition candidates said one of the biggest surprises of the campaign has been the warm reception they have received in what were once hostile pro-government strongholds.  Carlos Mendoza, 53, a motorcycle taxi driver and former convict who works in the district where Mr. Millán is running, said that he belongs to a group, known as a colectivo, that in the past was paid by the government to help out during campaigns, attend rallies and drive voters to the polls. Such groups were also often used to intimidate opposition supporters.  “They called us again this time,” Mr. Mendoza said. “I told them, ‘No way, you’re not using me again.’ ”  “We’re from the streets,” he said, “and we want change.”  A version of this article appears in print on December 5, 2015, on page A9 of the New York edition with the headline: Venezuela’s Economic Pain Gives Opposition Lift Before Vote. Order Reprints| Today's Paper|Subscribe
The mood in neighborhoods that were once strongholds of Hugo Chávez now seems receptive to opposition candidates in Venezuela.