HENRIQUE Capriles knew the odds when he decided to run against Hugo Chavez: He called Venezuela's presidential campaign a contest between "David and Goliath."

Unfortunately for his Democratic Unity (MUD) coalition, Capriles' story departed from the Bible's familiar ending. On Oct. 7, Chavez was re-elected with 55 percent of the vote, putting him six years closer to his stated goal of ruling the country until 2031. Capriles got 44 percent.

The president did far worse than in 2006, when he took 63 percent. But the opposition had much higher hopes than merely narrowing the incumbent's margin of victory. After years of internal divisions and political irrelevance, they held a primary and united around Capriles, a centrist state governor. He ran a campaign that was widely recognized as disciplined and effective, boldly contesting chavista strongholds in the countryside and slums while motivating his urban, middle-class base to turn out in record numbers.

The opposition has cried fraud in the past following electoral setbacks. This time, however, Capriles conceded and congratulated Chavez soon after the results were announced.

In response, Chavez, who had previously called Capriles a "fascist" and a "pig," acknowledged his opponent's "democratic" behavior. He even called him for a "pleasant" phone conversation. Capriles said he had asked the president to respect the 6.6 million who had voted against him. The pleasantries did not last long, however. "I didn't come here to subordinate myself...to the bourgeoisie," Chavez said on Oct. 9.

He owes his political resilience above all to Venezuela's continuing oil boom. Although the country's production of petroleum has declined on his watch, price increases have given him billions of dollars to spend on largesse for his supporters. During his re-election campaign the government subsidized household goods and launched a crash program of cheap public housing. He also took full advantage of his incumbency, by filling the airwaves with advertisements extolling the government's purported achievements using dubious statistics. In contrast, election rules confined Capriles to three minutes of broadcast time a day.

The immediate task for the MUD will be to regroup in time for state elections on Dec. 16. Chavez won the presidential vote in all but two states. All 23 governorships will be contested, eight of which are held by the opposition -- including Capriles' in the state of Miranda, which contains much of Caracas, the capital.

Capriles has said he will run for re-election in Miranda and he has also made clear that he hopes to remain as leader of the opposition. His victory in the primary and his strong presidential campaign have added to his political capital. "To know how to win, one must know how to lose," Capriles said on election day.

Still, keeping the opposition motivated and united will not be easy. The failure of even a well-run campaign like Capriles' in a favorable environment is sure to raise doubts about whether the president has slanted the contest too much in his favor ever to be beaten at the ballot box.

Chavez will not have long to revel in his victory. The opposition's strong showing suggests he may have trouble advancing his agenda to make his "21st-century socialist revolution" irreversible and set up a "communal state," at odds with his own 1999 constitution. His last effort at constitutional reform was defeated in a 2007 referendum -- though he did win a subsequent vote to remove presidential term limits, which enabled him to run again this year.

Moreover, the economy is showing strains. Although public spending drove growth up to 5 percent this year, inflation is near 20 percent and the Venezuelan currency trades on the black market for a third of the official rate. Most economists expect a big devaluation. As the government borrows ever more money to pay for Chavez's projects, markets are pricing Venezuelan bonds to default. Any decline in oil prices would send the economy into a tailspin.

Most uncertain is the president's health. Chavez has undergone three operations for an unspecified "pelvic" cancer. He recovered to mount a spirited campaign, albeit with a relatively light schedule, and says he is now cured. But he has never revealed any details of his treatment or prognosis, and no one has any idea whether he will survive this term.