By Daniel Wallis and Brian Ellsworth
CARACAS (Reuters) - Nicolas Maduro will be sworn in as Venezuela's president on Friday at a ceremony attended by several Latin American leaders, after a decision to widen an electronic audit of the vote took some of the heat out of a dispute over his election.
Maduro, a former bus driver-turned-foreign minister who became the late Hugo Chavez's chosen successor, narrowly beat opposition challenger Henrique Capriles in Sunday's vote.
He accused Capriles of triggering post-election violence that killed eight people, though the opposition says Maduro allies staged some incidents to distract from the vote dispute.
"We have stopped a coup in its first stage. They are beaten, but they are coming back with a new attack," Maduro said on Thursday before flying to Peru for a last-minute meeting of South American leaders to discuss the situation.
While he was in Lima, Venezuela's electoral authority said it would widen to 100 percent an audit of electronic votes from a previous audit that reviewed 54 percent.
"We do this in order to preserve a climate of harmony ... and isolate violent sectors that are seeking to injure democracy," Tibisay Lucena, president of the National Electoral Council (CNE), said in a televised speech to the nation.
Maduro, 50, received a show of support at the late-night meeting of a group of South American nations called Unasur, which welcomed the CNE's move, congratulated him on his victory, and called on both sides to reject violence.
Capriles, who insists the opposition's figures show he won, said he accepted the CNE's decision although it fell short of the manual recount he had wanted. He said he was sure the truth would come out.
The date for the start of the wider audit is to be announced by next week.
Heads of state who will join Maduro's swearing-in include Brazil's Dilma Rousseff and Iran's Mahmoud Ahmadinejad, along with leaders of Chavez-era allies such as Bolivia, Uruguay and Nicaragua.
Russia and China, both partners in major oil projects in Venezuela's vast Orinoco belt region, sent delegations headed by senior officials.
The inauguration ceremony is due to be held at the National Assembly and will be followed by a military parade. Jets making practice runs have often soared over the capital this week.
Argentine President Cristina Fernandez said on Twitter that on Saturday morning she planned to visit the military museum in Caracas where her friend Chavez is buried.
"I want to be there a bit more alone, without so many people, without so much noise," she said. "To Caracas, without Hugo. It's going to be difficult and strange at the same time. His funerals were so impressive it was like I was in a daze."
The unrest in Venezuela, just weeks after Chavez's death from cancer, has exposed the deep polarization of a country split down the middle between pro- and anti-government factions.
Maduro's administration accuses "fascist" Capriles supporters of going on the rampage, shooting people, attacking offices belonging to the ruling Socialist Party, and setting fire to government-run clinics staffed by Cuban doctors.
Capriles, who has repeatedly called on his supporters to behave peacefully, has said the government was to blame for any violence because of its refusal to hold a recount.
"We have identified where the problems are. With this, we're where we want to be," he said of the vote audit. He also demanded the government stop "persecuting" his supporters, and said there was no evidence of attacks on the state-run clinic, known as CDIs.
"I asked for reports from all the country's municipalities about incidents at CDIs," he said on Twitter. "None were affected. Only sick minds would do something like this!"
(Editing by Philip Barbara)