CARACAS, Venezuela -- In an unexpectedly close race, Venezuelans narrowly voted to continue Hugo Chávez's revolution, electing his handpicked political heir, Nicolás Maduro, to serve the remainder of his six-year term as president, officials said late Sunday.
But the thin margin of victory could complicate the task of governing for Mr. Maduro, emboldening the political opposition and possibly undermining Mr. Maduro's stature within Mr. Chávez's movement.
His opponent, Henrique Capriles Radonski, refused to recognize the results, citing irregularities in the voting and calling for a recount.
Mr. Maduro, the acting president, narrowly defeated Mr. Capriles, a state governor who ran strongly against Mr. Chávez in October. Election authorities said that with more than 99 percent of the vote counted, Mr. Maduro had 50.6 percent to Mr. Capriles's 49.1 percent. More than 78 percent of registered voters cast ballots.
"These are the irreversible results that the Venezuelan people have decided with this electoral process," Tibisay Lucena, the head of the electoral council, said as she read the result on national television late Sunday.
Mr. Maduro gave a defiant speech that suggested little willingness to make concessions. "We have a just, legal, constitutional and popular electoral victory," he said.
Mr. Capriles was equally defiant. "We are not going to recognize the result until every vote is counted, one by one," Mr. Capriles said. "The big loser today is you, you and what you represent," he said, referring to Mr. Maduro.
Meanwhile, there were also signs that the strident, Chávez-style anti-American message that Mr. Maduro used during the campaign would now be set aside to improve Venezuela's strained relations with the United States.
Venezuela is a major oil supplier to the United States with immense reserves, and under Mr. Chávez it has also been a major thorn in Washington's side, wielding its oil and its diplomatic muscle to oppose American policy everywhere from Cuba to Syria. Mr. Chávez, who succumbed to cancer on March 5, built his political career on flaying the United States and its traditional allies in the Venezuelan establishment, and Mr. Maduro followed his mentor's script throughout the campaign with an acolyte's zeal.
He accused former American diplomats of plotting to kill him, suggested that the United States had caused Mr. Chávez's illness, and had his foreign minister shut the door on informal talks with the United States that began late last year. A senior State Department official in Washington said the harsh rhetoric had made the possibility of improved relations more difficult.
But over the weekend, with his election victory looking likely, Mr. Maduro sent a private signal to Washington that he was ready to turn the page. Bill Richardson, the former governor of New Mexico, who was in Caracas as a representative of the Organization of American States, said in an interview that Mr. Maduro called him aside after a meeting of election observers on Saturday and asked him to carry a message.
"He said, 'We want to improve the relationship with the U.S., regularize the relationship,' " Mr. Richardson said.
The foreign minister, Elías Jaua, met with Mr. Richardson on Sunday, and said Venezuela was ready to resume the talks that it had cut off, Mr. Richardson said.
Though Mr. Chávez's death raised the possibility of a realignment in the hemisphere, Mr. Maduro's victory would seem to extend the life of the leftist coalition of countries that coalesced around Mr. Chávez. Mr. Maduro seems certain to continue the lifeline of oil sales on preferential terms that Venezuela provides to Cuba, whose leaders were close allies of Mr. Chávez.
Yet even his supporters say that Mr. Maduro lacks his predecessor's sharp political instincts and magnetism, and many questions remain about how effectively he will lead at home and abroad.
At the voting booth on Sunday, Mr. Chávez was as much on voters' minds as the two candidates were. Mr. Maduro went all-out to associate himself with the dead leader and his idiosyncratic style of socialism, which remains broadly popular in Venezuela, especially among poorer voters. His image was everywhere in Mr. Maduro's campaign, and the candidate even told voters that Mr. Chávez's spirit had appeared to him in the form of a little bird. An awkward campaigner who struggled to connect with supporters, Mr. Maduro took to whistling like a bird at his rallies.
Voters seemed to respond on Sunday. "The commander's legacy should continue, toward a better future," said Alejandro Rodríguez, 34, after casting his ballot at a school in a neighborhood known as Gato Negro, or Black Cat. "I voted for the commander's son, Nicolás Maduro," Mr. Rodríguez said, echoing the candidate who called himself "the son of Chávez." Driving the point home, a large banner on a pedestrian overpass near the school entrance said, "A vote for Maduro is a vote for Chávez."
Just as he did when running against Mr. Chávez last October, Mr. Capriles managed to energize and inject hope into a fractious and battered opposition. He represented a coalition of groups from across the political spectrum. But it was not clear if the opposition's unity and momentum could be maintained after the defeat, in the face of a government that holds a virtual monopoly on power.
In the election last October, Mr. Chávez received nearly 8.2 million votes, or 55 percent, compared to nearly 6.6 million, or 44 percent, for Mr. Capriles.
But Mr. Maduro could also face pressure from within Mr. Chávez's movement, from competing leaders or groups in government and the armed forces who do not feel the need to obey him with the absolute loyalty they once gave to Mr. Chávez.
Just as Mr. Chávez did, Mr. Maduro sought to exploit the bitter divide between loyalists and opponents.
"The country is going to be more polarized, divided into two parts," said Rafael Huizi Clavier, a retired vice admiral who supported Mr. Capriles. "There is more confrontation, because the campaign has been very hard and the differences have been exacerbated. There is more antagonism between the two sides."
The new president will face a host of challenges as he serves out the rest of Mr. Chavez's term, which began in January. The economy suffers from high inflation -- just over 20 percent last year -- and from chronic shortages of many basic foods, medicines and other goods. Many economists predict that economic growth will slow significantly this year and some say the nation could slip into recession.
The government-owned oil monopoly, Petróleos de Venezuela, is a crucial source of government revenue, but it has been struggling with stagnant production and problems at its refineries. The country's electrical grid is plagued by blackouts, which are frequent in many areas of the country outside Caracas.
And violent crime is rampant. As recently as Thursday, four people were shot to death in three separate incidents at a sprawling election rally for Mr. Maduro in Caracas, according to local news media accounts.
María Eugenia Díaz and Paula Ramón contributed reporting.world
This article originally appeared in The New York Times.