It certainly looked like a victory rally. Thousands of people in red T-shirts streamed into Plaza O'Leary singing and chanting. On stage a salsa band blasted joyful lyrics about the revolution. Government officials blew kisses.

When Hugo Chávez arrived the fiesta was complete. He climbed the stage and waved a sword used by the 19th-century independence hero, Simon Bolivar. The plaza erupted as one voice. "Ooh! Ah! Chávez no se va! [Chávez will not go!]"

It was a show of strength this week to reflect the Venezuelan president's popularity and power as a new national assembly was sworn in a few blocks away in central Caracas. His United Socialist party filled most of the seats and for good measure he assumed decree powers, enabling him to bypass the opposition. "They will never return to power!" Chávez told the cheering crowd.

But they have returned. The opposition now control 67 of the assembly's 165 seats, enough to end the two-thirds super-majority which the president previously enjoyed courtesy of an opposition boycott of the 2005 election.

That may seem a modest gain, but in a country where the president controls all major state institutions, including the army, courts and central bank, it gives opponents a platform to challenge Chávez in the runup to next year's presidential election.

"We're back!" chanted opposition deputies as they entered the golden-domed assembly, brandishing signs saying "52%", the proportion of the popular vote they won in September's election.

A controversial election law meant that did not translate into a majority of seats, but the opposition feels political winds have changed in its favour. A few blocks from Chávez's rally the opposition held its own upbeat one. "Chávez has lost support, a lot of people have crossed over to our side. We are the majority now," said Luis Guzman, 60.

The president's approval rating hovers around 50%, impressive for a 12-year incumbent but significantly below previously stellar figures. Caracas and other big cities turfed out chávista mayors and governors in 2008, sending shockwaves through the government.

The president's "situation room" in Miraflores palace is worried the economy could derail his bid for another six-year term. The rest of South America is booming but Venezuela is suffering stagflation. The economy shrank by 1.9% last year, its second consecutive year of recession, and its 26.9% inflation rate was among the world's highest.

This week the government devalued the bolivar by eliminating a two-tiered exchange rate – the second devaluation in a year. This, say analysts, will ease economic distortions but push inflation higher, hitting the poor hardest.

Oil prices are edging up, boosting the Opec country's state coffers, but foreign investment has evaporated and Venezuela's private sector is reeling from a series of nationalisations, expropriations and clashes with the government. "The announced devaluation does little to address Venezuela's macroeconomic imbalances," said Patrick Esteruelas, of the Eurasia Group.

Critics blame Chávez's spendthrift fiscal policies for many of the problems, but the president says fault lies with US-backed oligarchs and global capitalists who want to sabotage his effort to build "21st-century socialism".

Farmers in western states and students, among others, have staged protests against government interventions into farms and universities, giving authorities a taste of the dissent that could spread if the economy worsens.

At the rally Chávez, a former tank commander, warned of "great battles" ahead but said he would stay in office. "Right now I tell you that this soldier is going to be a candidate," he said.

The outgoing assembly used its final sessions to cement his position. In addition to granting Chávez decree powers for the next 18 months it has curbed the incoming assembly with new rules: it will meet just four days a month, speeches will be limited to 15 minutes and deputies will be banned from switching parties.

The previous assembly also named nine new pro-Chávez judges to the supreme court, banned foreign funding for non-governmental organisations and tightened internet regulations to punish online "disrespect" of public figures and institutions. A law putting universities under government control was dropped.

To the opposition that added up to a "coup against the constitution" but to Chávez supporters in Plaza O'Leary it was a legitimate and welcome effort to keep the commandante in charge.

"Maybe he's made some mistakes but he is still the best leader we've ever had. Whoever doesn't love Chávez doesn't love their mother," said Coromoto Soto, 46, a health worker. "I hope he stays in power for 20 years, 50 years." Her brother José, a security guard, shook his head. "Make that 100 years."

• This article was amended on 7 January 2011. The original referred to the Venezuelan president's achilles heal. This has been corrected.